keep alive should get a response

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@631965 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-02-28 13:29:35 +00:00
parent dd35ef43e5
commit a36426d202

View File

@ -126,7 +126,9 @@ public class InactivityMonitor extends TransportFilter {
ASYNC_TASKS.execute(new Runnable() { ASYNC_TASKS.execute(new Runnable() {
public void run() { public void run() {
try { try {
oneway(new KeepAliveInfo()); KeepAliveInfo info = new KeepAliveInfo();
info.setResponseRequired(true);
oneway(info);
} catch (IOException e) { } catch (IOException e) {
onException(e); onException(e);
} }
@ -173,22 +175,34 @@ public class InactivityMonitor extends TransportFilter {
commandReceived.set(true); commandReceived.set(true);
inReceive.set(true); inReceive.set(true);
try { try {
if (command.getClass() == WireFormatInfo.class) { if (command.getClass() == KeepAliveInfo.class) {
synchronized (this) { KeepAliveInfo info = (KeepAliveInfo) command;
IOException error=null; if (info.isResponseRequired()) {
remoteWireFormatInfo = (WireFormatInfo)command;
try { try {
startMonitorThreads(); info.setResponseRequired(false);
oneway(info);
} catch (IOException e) { } catch (IOException e) {
error = e; onException(e);
}
if( error!=null ) {
onException(error);
} }
} }
} } else {
synchronized (readChecker) { if (command.getClass() == WireFormatInfo.class) {
transportListener.onCommand(command); 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);
}
} }
} finally { } finally {