Add option to ignore the values in the remote WireFormatInfo in case the user wants control over the Brokers inactivity timeouts.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@905769 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2010-02-02 20:10:39 +00:00
parent c32820d87b
commit 4d0a8a5c7e
1 changed files with 50 additions and 39 deletions

View File

@ -62,6 +62,7 @@ public class InactivityMonitor extends TransportFilter {
private SchedulerTimerTask writeCheckerTask;
private SchedulerTimerTask readCheckerTask;
private boolean ignoreRemoteWireFormat = false;
private long readCheckTime;
private long writeCheckTime;
private long initialDelayTime;
@ -258,6 +259,10 @@ public class InactivityMonitor extends TransportFilter {
keepAliveResponseRequired = val;
}
public void setIgnoreRemoteWireFormat(boolean val) {
ignoreRemoteWireFormat = val;
}
private synchronized void startMonitorThreads() throws IOException {
if (monitorStarted.get()) {
return;
@ -269,8 +274,14 @@ public class InactivityMonitor extends TransportFilter {
return;
}
if (!ignoreRemoteWireFormat) {
readCheckTime = Math.min(localWireFormatInfo.getMaxInactivityDuration(), remoteWireFormatInfo.getMaxInactivityDuration());
initialDelayTime = Math.min(localWireFormatInfo.getMaxInactivityDurationInitalDelay(), remoteWireFormatInfo.getMaxInactivityDurationInitalDelay());
} else {
readCheckTime = localWireFormatInfo.getMaxInactivityDuration();
initialDelayTime = localWireFormatInfo.getMaxInactivityDurationInitalDelay();
}
if (readCheckTime > 0) {
monitorStarted.set(true);
writeCheckerTask = new SchedulerTimerTask(writeChecker);