ARTEMIS-209 fix keepAlive

This commit is contained in:
jbertram 2015-08-14 16:19:25 -05:00
parent cbebbc43fd
commit 976174305e
2 changed files with 15 additions and 4 deletions

View File

@ -201,11 +201,12 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor {
// the connection handles pings, negotiations directly. // the connection handles pings, negotiations directly.
// and delegate all other commands to manager. // and delegate all other commands to manager.
if (command.getClass() == KeepAliveInfo.class) { if (command.getClass() == KeepAliveInfo.class) {
dataReceived = true;
KeepAliveInfo info = (KeepAliveInfo) command; KeepAliveInfo info = (KeepAliveInfo) command;
if (info.isResponseRequired()) { info.setResponseRequired(false);
info.setResponseRequired(false); // if we don't respond to KeepAlive commands then the client will think the server is dead and timeout
protocolManager.sendReply(this, info); // for some reason KeepAliveInfo.isResponseRequired() is always false
} protocolManager.sendReply(this, info);
} }
else if (command.getClass() == WireFormatInfo.class) { else if (command.getClass() == WireFormatInfo.class) {
// amq here starts a read/write monitor thread (detect ttl?) // amq here starts a read/write monitor thread (detect ttl?)

View File

@ -87,6 +87,16 @@ public class SimpleOpenWireTest extends BasicOpenWireTest {
session.close(); session.close();
} }
@Test
public void testKeepAlive() throws Exception {
connection.start();
Thread.sleep(125000);
connection.createSession(false, 1);
}
@Test @Test
public void testSimpleTopic() throws Exception { public void testSimpleTopic() throws Exception {
connection.start(); connection.start();