only: minor refactoring
This commit is contained in:
parent
27b48c72c2
commit
94181dd2f3
|
@ -263,7 +263,7 @@ public class BinaryProtocol {
|
|||
tr.start();
|
||||
}
|
||||
|
||||
private void dropPending() {
|
||||
private static void dropPending(IoStream stream) {
|
||||
synchronized (stream.getIoLock()) {
|
||||
if (stream.isClosed())
|
||||
return;
|
||||
|
@ -468,17 +468,17 @@ public class BinaryProtocol {
|
|||
* @return null in case of IO issues
|
||||
*/
|
||||
public byte[] executeCommand(char opcode, byte[] packet, String msg) {
|
||||
linkManager.assertCommunicationThread();
|
||||
if (stream.isClosed())
|
||||
return null;
|
||||
|
||||
byte[] fullRequest = getFullRequest((byte) opcode, packet);
|
||||
|
||||
try {
|
||||
linkManager.assertCommunicationThread();
|
||||
dropPending();
|
||||
dropPending(stream);
|
||||
if (Bug3923.obscene)
|
||||
log.info("Sending opcode " + opcode + " payload " + packet.length);
|
||||
sendPacket(fullRequest);
|
||||
stream.sendPacket(fullRequest);
|
||||
return receivePacket(msg);
|
||||
} catch (IOException e) {
|
||||
log.error(msg + ": executeCommand failed: " + e);
|
||||
|
@ -559,10 +559,6 @@ public class BinaryProtocol {
|
|||
return state.getControllerConfiguration();
|
||||
}
|
||||
|
||||
private void sendPacket(byte[] command) throws IOException {
|
||||
stream.sendPacket(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method blocks until a confirmation is received or {@link Timeouts#BINARY_IO_TIMEOUT} is reached
|
||||
*
|
||||
|
|
|
@ -50,6 +50,7 @@ public class BinaryProtocolLogger {
|
|||
}
|
||||
};
|
||||
|
||||
// fragile or just scary: here we install a JVM level callback for gradual file footer
|
||||
Runtime.getRuntime().addShutdownHook(hook);
|
||||
needCompositeLogger = linkManager.getCompositeLogicEnabled();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue