protected void configureInactivityMonitor(String heartBeatConfig) throws ProtocolException { String[] keepAliveOpts = heartBeatConfig.split(Stomp.COMMA); if (keepAliveOpts == null || keepAliveOpts.length != 2) { throw new ProtocolException("Invalid heart-beat header:" + heartBeatConfig, true); } else { try { hbReadInterval = (Long.parseLong(keepAliveOpts[0])); hbWriteInterval = Long.parseLong(keepAliveOpts[1]); } catch(NumberFormatException e) { throw new ProtocolException("Invalid heart-beat header:" + heartBeatConfig, true); } try { StompInactivityMonitor monitor = this.stompTransport.getInactivityMonitor(); monitor.setReadCheckTime((long) (hbReadInterval * hbGracePeriodMultiplier)); monitor.setInitialDelayTime(Math.min(hbReadInterval, hbWriteInterval)); monitor.setWriteCheckTime(hbWriteInterval); monitor.startMonitoring(); } catch(Exception ex) { hbReadInterval = 0; hbWriteInterval = 0; } if (LOG.isDebugEnabled()) { LOG.debug("Stomp Connect heartbeat conf RW[{},{}]", hbReadInterval, hbWriteInterval); } } }
protected void configureInactivityMonitor(String heartBeatConfig) throws ProtocolException { String[] keepAliveOpts = heartBeatConfig.split(Stomp.COMMA); if (keepAliveOpts == null || keepAliveOpts.length != 2) { throw new ProtocolException("Invalid heart-beat header:" + heartBeatConfig, true); } else { try { hbReadInterval = (Long.parseLong(keepAliveOpts[0])); hbWriteInterval = Long.parseLong(keepAliveOpts[1]); } catch(NumberFormatException e) { throw new ProtocolException("Invalid heart-beat header:" + heartBeatConfig, true); } try { StompInactivityMonitor monitor = this.stompTransport.getInactivityMonitor(); monitor.setReadCheckTime((long) (hbReadInterval * hbGracePeriodMultiplier)); monitor.setInitialDelayTime(Math.min(hbReadInterval, hbWriteInterval)); monitor.setWriteCheckTime(hbWriteInterval); monitor.startMonitoring(); } catch(Exception ex) { hbReadInterval = 0; hbWriteInterval = 0; } if (LOG.isDebugEnabled()) { LOG.debug("Stomp Connect heartbeat conf RW[{},{}]", hbReadInterval, hbWriteInterval); } } }
protected void configureInactivityMonitor(String heartBeatConfig) throws ProtocolException { String[] keepAliveOpts = heartBeatConfig.split(Stomp.COMMA); if (keepAliveOpts == null || keepAliveOpts.length != 2) { throw new ProtocolException("Invalid heart-beat header:" + heartBeatConfig, true); } else { try { hbReadInterval = (Long.parseLong(keepAliveOpts[0])); hbWriteInterval = Long.parseLong(keepAliveOpts[1]); } catch(NumberFormatException e) { throw new ProtocolException("Invalid heart-beat header:" + heartBeatConfig, true); } try { StompInactivityMonitor monitor = this.stompTransport.getInactivityMonitor(); monitor.setReadCheckTime((long) (hbReadInterval * hbGracePeriodMultiplier)); monitor.setInitialDelayTime(Math.min(hbReadInterval, hbWriteInterval)); monitor.setWriteCheckTime(hbWriteInterval); monitor.startMonitoring(); } catch(Exception ex) { hbReadInterval = 0; hbWriteInterval = 0; } if (LOG.isDebugEnabled()) { LOG.debug("Stomp Connect heartbeat conf RW[{},{}]", hbReadInterval, hbWriteInterval); } } }