Author: rajdavies
Date: Thu Feb 28 05:29:35 2008
New Revision: 631965
URL: http://svn.apache.org/viewvc?rev=631965&view=rev
Log:
keep alive should get a response
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java?rev=631965&r1=631964&r2=631965&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
Thu Feb 28 05:29:35 2008
@@ -126,7 +126,9 @@
ASYNC_TASKS.execute(new Runnable() {
public void run() {
try {
- oneway(new KeepAliveInfo());
+ KeepAliveInfo info = new KeepAliveInfo();
+ info.setResponseRequired(true);
+ oneway(info);
} catch (IOException e) {
onException(e);
}
@@ -173,22 +175,34 @@
commandReceived.set(true);
inReceive.set(true);
try {
- if (command.getClass() == WireFormatInfo.class) {
- synchronized (this) {
- IOException error=null;
- remoteWireFormatInfo = (WireFormatInfo)command;
+ if (command.getClass() == KeepAliveInfo.class) {
+ KeepAliveInfo info = (KeepAliveInfo) command;
+ if (info.isResponseRequired()) {
try {
- startMonitorThreads();
+ info.setResponseRequired(false);
+ oneway(info);
} catch (IOException e) {
- error = e;
+ onException(e);
}
- if( error!=null ) {
- onException(error);
+ }
+ } else {
+ if (command.getClass() == WireFormatInfo.class) {
+ synchronized (this) {
+ IOException error = null;
+ remoteWireFormatInfo = (WireFormatInfo) command;
+ try {
+ startMonitorThreads();
+ } catch (IOException e) {
+ error = e;
+ }
+ if (error != null) {
+ onException(error);
+ }
}
}
- }
- synchronized (readChecker) {
- transportListener.onCommand(command);
+ synchronized (readChecker) {
+ transportListener.onCommand(command);
+ }
}
} finally {
|