This closes #2002
This commit is contained in:
commit
e0334dff0e
|
@ -78,6 +78,12 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
|
|||
|
||||
private String clientID;
|
||||
|
||||
|
||||
@Override
|
||||
public void scheduledFlush() {
|
||||
flush();
|
||||
}
|
||||
|
||||
// Constructors
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -52,6 +52,11 @@ public abstract class AbstractRemotingConnection implements RemotingConnection {
|
|||
this.creationTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduledFlush() {
|
||||
flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FailureListener> getFailureListeners() {
|
||||
return new ArrayList<>(failureListeners);
|
||||
|
|
|
@ -57,6 +57,8 @@ public interface RemotingConnection extends BufferHandler {
|
|||
*/
|
||||
String getRemoteAddress();
|
||||
|
||||
void scheduledFlush();
|
||||
|
||||
/**
|
||||
* add a failure listener.
|
||||
* <p>
|
||||
|
|
|
@ -60,6 +60,12 @@ public class ActiveMQProtonRemotingConnection extends AbstractRemotingConnection
|
|||
return manager;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void scheduledFlush() {
|
||||
amqpConnection.scheduledFlush();
|
||||
}
|
||||
|
||||
/*
|
||||
* This can be called concurrently by more than one thread so needs to be locked
|
||||
*/
|
||||
|
|
|
@ -123,6 +123,11 @@ public class AMQPConnectionContext extends ProtonInitializable implements EventH
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void scheduledFlush() {
|
||||
handler.scheduledFlush();
|
||||
}
|
||||
|
||||
public boolean isIncomingConnection() {
|
||||
return isIncomingConnection;
|
||||
}
|
||||
|
|
|
@ -131,6 +131,17 @@ public class ProtonHandler extends ProtonInitializable implements SaslListener {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We cannot flush until the initial handshake was finished.
|
||||
* If this happens before the handshake, the connection response will happen without SASL
|
||||
* and the client will respond and fail with an invalid code.
|
||||
* */
|
||||
public void scheduledFlush() {
|
||||
if (receivedFirstPacket) {
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
||||
public int capacity() {
|
||||
lock.lock();
|
||||
try {
|
||||
|
|
|
@ -58,6 +58,12 @@ public class MQTTConnection implements RemotingConnection {
|
|||
this.destroyed = false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void scheduledFlush() {
|
||||
flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWritable(ReadyListener callback) {
|
||||
return transportConnection.isWritable(callback);
|
||||
|
|
|
@ -116,6 +116,12 @@ public final class StompConnection implements RemotingConnection {
|
|||
return frameHandler;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void scheduledFlush() {
|
||||
flush();
|
||||
}
|
||||
|
||||
public StompFrame decode(ActiveMQBuffer buffer) throws ActiveMQStompException {
|
||||
StompFrame frame = null;
|
||||
try {
|
||||
|
|
|
@ -716,7 +716,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif
|
|||
// this is using a different thread
|
||||
// as if anything wrong happens on flush
|
||||
// failure detection could be affected
|
||||
conn.flush();
|
||||
conn.scheduledFlush();
|
||||
} catch (Throwable e) {
|
||||
ActiveMQServerLogger.LOGGER.failedToFlushOutstandingDataFromTheConnection(e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue