protected Transport createInactivityMonitor(Transport transport, WireFormat format) { return new InactivityMonitor(transport, format); } }
@Override protected void processInboundWireFormatInfo(WireFormatInfo info) throws IOException { stopConnectCheckTask(); IOException error = null; remoteWireFormatInfo = info; try { startMonitorThreads(); } catch (IOException e) { error = e; } if (error != null) { onException(error); } }
@Override protected synchronized void startMonitorThreads() throws IOException { if (isMonitorStarted()) { return; } long readCheckTime = getReadCheckTime(); if (readCheckTime > 0) { setWriteCheckTime(writeCheckValueFromReadCheck(readCheckTime)); } super.startMonitorThreads(); }
@Override public void start() throws Exception { if (!isMonitorStarted()) { startConnectCheckTask(); } super.start(); }
@Override protected boolean configuredOk() throws IOException { boolean configured = false; if (ignoreAllWireFormatInfo) { configured = true; } else if (localWireFormatInfo != null && remoteWireFormatInfo != null) { if (!ignoreRemoteWireFormat) { if (LOG.isDebugEnabled()) { LOG.debug("Using min of local: " + localWireFormatInfo + " and remote: " + remoteWireFormatInfo); } long readCheckTime = Math.min(localWireFormatInfo.getMaxInactivityDuration(), remoteWireFormatInfo.getMaxInactivityDuration()); long writeCheckTime = writeCheckValueFromReadCheck(readCheckTime); setReadCheckTime(readCheckTime); setInitialDelayTime(Math.min(localWireFormatInfo.getMaxInactivityDurationInitalDelay(), remoteWireFormatInfo.getMaxInactivityDurationInitalDelay())); setWriteCheckTime(writeCheckTime); } else { if (LOG.isDebugEnabled()) { LOG.debug("Using local: " + localWireFormatInfo); } long readCheckTime = localWireFormatInfo.getMaxInactivityDuration(); long writeCheckTime = writeCheckValueFromReadCheck(readCheckTime); setReadCheckTime(readCheckTime); setInitialDelayTime(localWireFormatInfo.getMaxInactivityDurationInitalDelay()); setWriteCheckTime(writeCheckTime); } configured = true; } return configured; }
try { info.setResponseRequired(false); oneway(info); } catch (IOException e) { onException(e); remoteWireFormatInfo = (WireFormatInfo) command; try { startMonitorThreads(); } catch (IOException e) { error = e; onException(error);
@Override protected void processOutboundWireFormatInfo(WireFormatInfo info) throws IOException{ localWireFormatInfo = info; startMonitorThreads(); }
public void run() { if (monitorStarted.get()) { try { KeepAliveInfo info = new KeepAliveInfo(); info.setResponseRequired(keepAliveResponseRequired); oneway(info); } catch (IOException e) { onException(e); } } }; });
@Override public void onCommand(Object command) { if (command.getClass() == ConnectionInfo.class || command.getClass() == BrokerInfo.class) { synchronized (this) { try { LOG.trace("Connection {} attempted on HTTP based transport: {}", command, this); processInboundWireFormatInfo(null); } catch (IOException e) { onException(e); } } } super.onCommand(command); } }
public void run() { onException(new InactivityIOException("Channel was inactive for too (>" + readCheckTime + ") long: "+next.getRemoteAddress())); };
@Override protected boolean configuredOk() throws IOException { boolean configured = false; if (ignoreAllWireFormatInfo) { configured = true; } else if (localWireFormatInfo != null && remoteWireFormatInfo != null) { if (!ignoreRemoteWireFormat) { if (LOG.isDebugEnabled()) { LOG.debug("Using min of local: " + localWireFormatInfo + " and remote: " + remoteWireFormatInfo); } long readCheckTime = Math.min(localWireFormatInfo.getMaxInactivityDuration(), remoteWireFormatInfo.getMaxInactivityDuration()); long writeCheckTime = writeCheckValueFromReadCheck(readCheckTime); setReadCheckTime(readCheckTime); setInitialDelayTime(Math.min(localWireFormatInfo.getMaxInactivityDurationInitalDelay(), remoteWireFormatInfo.getMaxInactivityDurationInitalDelay())); setWriteCheckTime(writeCheckTime); } else { if (LOG.isDebugEnabled()) { LOG.debug("Using local: " + localWireFormatInfo); } long readCheckTime = localWireFormatInfo.getMaxInactivityDuration(); long writeCheckTime = writeCheckValueFromReadCheck(readCheckTime); setReadCheckTime(readCheckTime); setInitialDelayTime(localWireFormatInfo.getMaxInactivityDurationInitalDelay()); setWriteCheckTime(writeCheckTime); } configured = true; } return configured; }
@Override public void start() throws Exception { if (!isMonitorStarted()) { startConnectCheckTask(); } super.start(); }
@Override protected void processOutboundWireFormatInfo(WireFormatInfo info) throws IOException{ localWireFormatInfo = info; startMonitorThreads(); }
@Override public void onCommand(Object command) { if (command.getClass() == ConnectionInfo.class || command.getClass() == BrokerInfo.class) { synchronized (this) { try { LOG.trace("Connection {} attempted on HTTP based transport: {}", command, this); processInboundWireFormatInfo(null); } catch (IOException e) { onException(e); } } } super.onCommand(command); } }
@Override protected synchronized void startMonitorThreads() throws IOException { if (isMonitorStarted()) { return; } long readCheckTime = getReadCheckTime(); if (readCheckTime > 0) { setWriteCheckTime(writeCheckValueFromReadCheck(readCheckTime)); } super.startMonitorThreads(); }
@Override protected boolean configuredOk() throws IOException { boolean configured = false; if (ignoreAllWireFormatInfo) { configured = true; } else if (localWireFormatInfo != null && remoteWireFormatInfo != null) { if (!ignoreRemoteWireFormat) { if (LOG.isDebugEnabled()) { LOG.debug("Using min of local: " + localWireFormatInfo + " and remote: " + remoteWireFormatInfo); } long readCheckTime = Math.min(localWireFormatInfo.getMaxInactivityDuration(), remoteWireFormatInfo.getMaxInactivityDuration()); long writeCheckTime = writeCheckValueFromReadCheck(readCheckTime); setReadCheckTime(readCheckTime); setInitialDelayTime(Math.min(localWireFormatInfo.getMaxInactivityDurationInitalDelay(), remoteWireFormatInfo.getMaxInactivityDurationInitalDelay())); setWriteCheckTime(writeCheckTime); } else { if (LOG.isDebugEnabled()) { LOG.debug("Using local: " + localWireFormatInfo); } long readCheckTime = localWireFormatInfo.getMaxInactivityDuration(); long writeCheckTime = writeCheckValueFromReadCheck(readCheckTime); setReadCheckTime(readCheckTime); setInitialDelayTime(localWireFormatInfo.getMaxInactivityDurationInitalDelay()); setWriteCheckTime(writeCheckTime); } configured = true; } return configured; }
protected Transport configureTransport(Transport transport) { transport = new InactivityMonitor(transport, serverTransport.getWireFormat()); getAcceptListener().onAccept(transport); return transport; }
@Override protected void processInboundWireFormatInfo(WireFormatInfo info) throws IOException { stopConnectCheckTask(); IOException error = null; remoteWireFormatInfo = info; try { startMonitorThreads(); } catch (IOException e) { error = e; } if (error != null) { onException(error); } }
@Override public void start() throws Exception { if (!isMonitorStarted()) { startConnectCheckTask(); } super.start(); }
@Override protected void processOutboundWireFormatInfo(WireFormatInfo info) throws IOException{ localWireFormatInfo = info; startMonitorThreads(); }