/** * Invoked when any TCP connectivity issue is detected, i.e. failure to establish * the TCP connection, failure to send a message, missed heartbeat, etc. */ protected void handleTcpConnectionFailure(String error, @Nullable Throwable ex) { if (logger.isInfoEnabled()) { logger.info("TCP connection failure in session " + this.sessionId + ": " + error, ex); } try { sendStompErrorFrameToClient(error); } finally { try { clearConnection(); } catch (Throwable ex2) { if (logger.isDebugEnabled()) { logger.debug("Failure while clearing TCP connection state in session " + this.sessionId, ex2); } } } }
/** * After a DISCONNECT there should be no more client frames so we can * close the connection pro-actively. However, if the DISCONNECT has a * receipt header we leave the connection open and expect the server will * respond with a RECEIPT and then close the connection. * @see <a href="http://stomp.github.io/stomp-specification-1.2.html#DISCONNECT"> * STOMP Specification 1.2 DISCONNECT</a> */ private void afterDisconnectSent(StompHeaderAccessor accessor) { if (accessor.getReceipt() == null) { try { clearConnection(); } catch (Throwable ex) { if (logger.isDebugEnabled()) { logger.debug("Failure while clearing TCP connection state in session " + this.sessionId, ex); } } } }
@Override public void afterConnectionClosed() { if (this.tcpConnection == null) { return; } try { if (logger.isDebugEnabled()) { logger.debug("TCP connection to broker closed in session " + this.sessionId); } sendStompErrorFrameToClient("Connection to broker closed."); } finally { try { // Prevent clearConnection() from trying to close this.tcpConnection = null; clearConnection(); } catch (Throwable ex) { // Shouldn't happen with connection reset beforehand } } }
if (handler != null) { handler.sendStompErrorFrameToClient("Broker not available."); handler.clearConnection();
if (handler != null) { handler.sendStompErrorFrameToClient("Broker not available."); handler.clearConnection();
@Override public void afterConnectionClosed() { if (this.tcpConnection == null) { return; } try { if (logger.isDebugEnabled()) { logger.debug("TCP connection to broker closed in session " + this.sessionId); } sendStompErrorFrameToClient("Connection to broker closed."); } finally { try { // Prevent clearConnection() from trying to close this.tcpConnection = null; clearConnection(); } catch (Throwable ex) { // Shouldn't happen with connection reset beforehand } } }
/** * Invoked when any TCP connectivity issue is detected, i.e. failure to establish * the TCP connection, failure to send a message, missed heartbeat, etc. */ protected void handleTcpConnectionFailure(String error, @Nullable Throwable ex) { if (logger.isInfoEnabled()) { logger.info("TCP connection failure in session " + this.sessionId + ": " + error, ex); } try { sendStompErrorFrameToClient(error); } finally { try { clearConnection(); } catch (Throwable ex2) { if (logger.isDebugEnabled()) { logger.debug("Failure while clearing TCP connection state in session " + this.sessionId, ex2); } } } }
@Override public void afterConnectionClosed() { if (this.tcpConnection == null) { return; } try { if (logger.isDebugEnabled()) { logger.debug("TCP connection to broker closed in session " + this.sessionId); } sendStompErrorFrameToClient("Connection to broker closed."); } finally { try { // Prevent clearConnection() from trying to close this.tcpConnection = null; clearConnection(); } catch (Throwable ex) { // Shouldn't happen with connection reset beforehand } } }
/** * Invoked when any TCP connectivity issue is detected, i.e. failure to establish * the TCP connection, failure to send a message, missed heartbeat, etc. */ protected void handleTcpConnectionFailure(String error, @Nullable Throwable ex) { if (logger.isInfoEnabled()) { logger.info("TCP connection failure in session " + this.sessionId + ": " + error, ex); } try { sendStompErrorFrameToClient(error); } finally { try { clearConnection(); } catch (Throwable ex2) { if (logger.isDebugEnabled()) { logger.debug("Failure while clearing TCP connection state in session " + this.sessionId, ex2); } } } }
/** * After a DISCONNECT there should be no more client frames so we can * close the connection pro-actively. However, if the DISCONNECT has a * receipt header we leave the connection open and expect the server will * respond with a RECEIPT and then close the connection. * @see <a href="http://stomp.github.io/stomp-specification-1.2.html#DISCONNECT"> * STOMP Specification 1.2 DISCONNECT</a> */ private void afterDisconnectSent(StompHeaderAccessor accessor) { if (accessor.getReceipt() == null) { try { clearConnection(); } catch (Throwable ex) { if (logger.isDebugEnabled()) { logger.debug("Failure while clearing TCP connection state in session " + this.sessionId, ex); } } } }
/** * After a DISCONNECT there should be no more client frames so we can * close the connection pro-actively. However, if the DISCONNECT has a * receipt header we leave the connection open and expect the server will * respond with a RECEIPT and then close the connection. * @see <a href="http://stomp.github.io/stomp-specification-1.2.html#DISCONNECT"> * STOMP Specification 1.2 DISCONNECT</a> */ private void afterDisconnectSent(StompHeaderAccessor accessor) { if (accessor.getReceipt() == null) { try { clearConnection(); } catch (Throwable ex) { if (logger.isDebugEnabled()) { logger.debug("Failure while clearing TCP connection state in session " + this.sessionId, ex); } } } }
if (handler != null) { handler.sendStompErrorFrameToClient("Broker not available."); handler.clearConnection();
/** * Invoked when any TCP connectivity issue is detected, i.e. failure to establish * the TCP connection, failure to send a message, missed heartbeat, etc. */ protected void handleTcpConnectionFailure(String error, @Nullable Throwable ex) { if (logger.isInfoEnabled()) { logger.info("TCP connection failure in session " + this.sessionId + ": " + error, ex); } try { sendStompErrorFrameToClient(error); } finally { try { clearConnection(); } catch (Throwable ex2) { if (logger.isDebugEnabled()) { logger.debug("Failure while clearing TCP connection state in session " + this.sessionId, ex2); } } } }
@Override public void afterConnectionClosed() { if (this.tcpConnection == null) { return; } try { if (logger.isDebugEnabled()) { logger.debug("TCP connection to broker closed in session " + this.sessionId); } sendStompErrorFrameToClient("Connection to broker closed."); } finally { try { // Prevent clearConnection() from trying to close this.tcpConnection = null; clearConnection(); } catch (Throwable ex) { // Shouldn't happen with connection reset beforehand } } }
/** * After a DISCONNECT there should be no more client frames so we can * close the connection pro-actively. However, if the DISCONNECT has a * receipt header we leave the connection open and expect the server will * respond with a RECEIPT and then close the connection. * @see <a href="http://stomp.github.io/stomp-specification-1.2.html#DISCONNECT"> * STOMP Specification 1.2 DISCONNECT</a> */ private void afterDisconnectSent(StompHeaderAccessor accessor) { if (accessor.getReceipt() == null) { try { clearConnection(); } catch (Throwable ex) { if (logger.isDebugEnabled()) { logger.debug("Failure while clearing TCP connection state in session " + this.sessionId, ex); } } } }
if (handler != null) { handler.sendStompErrorFrameToClient("Broker not available."); handler.clearConnection();