Catch exception while clearing TCP conn to broker

When a DISCONNECT is sent to the broker, we proactively close the TCP
connection unless the DISCONNECT has a receipt header. Depending on
the timing, the broker may also close the connection on its side.
That appears to cause an exception in reactor on the CI server, e.g.:

https://build.spring.io/browse/SPR-PUB-JOB1-1715/test/case/135247530

This change traps the exceptions and prevents it from propagating.
master
Rossen Stoyanchev 10 years ago
parent 5444c35777
commit 6c57c3e4b5
  1. 14
      spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java

@ -552,9 +552,8 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
clearConnection();
}
catch (Throwable ex2) {
if (logger.isErrorEnabled()) {
logger.error("Failure while cleaning up state for TCP connection in session " +
this.sessionId, ex2);
if (logger.isDebugEnabled()) {
logger.debug("Failure while clearing TCP connection state in session " + this.sessionId, ex2);
}
}
}
@ -771,7 +770,14 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
*/
private void afterDisconnectSent(StompHeaderAccessor accessor) {
if (accessor.getReceipt() == null) {
clearConnection();
try {
clearConnection();
}
catch (Throwable ex) {
if (logger.isDebugEnabled()) {
logger.debug("Failure while clearing TCP connection state in session " + this.sessionId, ex);
}
}
}
}

Loading…
Cancel
Save