mirror of https://github.com/apache/activemq.git
NO-JIRA Allow for the disconnect call in the test to fail as the short
keepAlive interval can trigger a shutdown of the socket before we have a chance to write the disconnect depending on the timing.
This commit is contained in:
parent
2788bd5584
commit
30d6ad72fa
|
@ -80,7 +80,7 @@ public class MQTTSocket extends AbstractMQTTSocket implements WebSocketListener
|
|||
try {
|
||||
getProtocolConverter().onMQTTCommand(new DISCONNECT().encode());
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Failed to close WebSocket", e);
|
||||
LOG.debug("Failed to close MQTT WebSocket cleanly", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,11 +64,11 @@ public class StompSocket extends AbstractStompSocket implements WebSocketListene
|
|||
public void onWebSocketClose(int arg0, String arg1) {
|
||||
try {
|
||||
if (protocolLock.tryLock() || protocolLock.tryLock(ORDERLY_CLOSE_TIMEOUT, TimeUnit.SECONDS)) {
|
||||
LOG.info("Stomp WebSocket closed: code[{}] message[{}]", arg0, arg1);
|
||||
LOG.debug("Stomp WebSocket closed: code[{}] message[{}]", arg0, arg1);
|
||||
protocolConverter.onStompCommand(new StompFrame(Stomp.Commands.DISCONNECT));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Failed to close WebSocket", e);
|
||||
LOG.debug("Failed to close STOMP WebSocket cleanly", e);
|
||||
} finally {
|
||||
if (protocolLock.isHeldByCurrentThread()) {
|
||||
protocolLock.unlock();
|
||||
|
|
|
@ -283,6 +283,10 @@ public class StompWSTransportTest extends WSTransportTestSupport {
|
|||
service.shutdownNow();
|
||||
service.awaitTermination(5, TimeUnit.SECONDS);
|
||||
|
||||
try {
|
||||
wsStompConnection.sendFrame(new StompFrame(Stomp.Commands.DISCONNECT));
|
||||
} catch (Exception ex) {
|
||||
LOG.info("Caught exception on write of disconnect", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue