You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2015/08/15 01:49:23 UTC

[2/3] activemq-artemis git commit: ARTEMIS-209 fix keepAlive

ARTEMIS-209 fix keepAlive


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/97617430
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/97617430
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/97617430

Branch: refs/heads/master
Commit: 976174305e006c50cd9a3c09fddea6a9505d1746
Parents: cbebbc4
Author: jbertram <jb...@apache.org>
Authored: Fri Aug 14 16:19:25 2015 -0500
Committer: jbertram <jb...@apache.org>
Committed: Fri Aug 14 16:20:10 2015 -0500

----------------------------------------------------------------------
 .../core/protocol/openwire/OpenWireConnection.java        |  9 +++++----
 .../tests/integration/openwire/SimpleOpenWireTest.java    | 10 ++++++++++
 2 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/97617430/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index fc14382..30ffb06 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -201,11 +201,12 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor {
          // the connection handles pings, negotiations directly.
          // and delegate all other commands to manager.
          if (command.getClass() == KeepAliveInfo.class) {
+            dataReceived = true;
             KeepAliveInfo info = (KeepAliveInfo) command;
-            if (info.isResponseRequired()) {
-               info.setResponseRequired(false);
-               protocolManager.sendReply(this, info);
-            }
+            info.setResponseRequired(false);
+            // if we don't respond to KeepAlive commands then the client will think the server is dead and timeout
+            // for some reason KeepAliveInfo.isResponseRequired() is always false
+            protocolManager.sendReply(this, info);
          }
          else if (command.getClass() == WireFormatInfo.class) {
             // amq here starts a read/write monitor thread (detect ttl?)

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/97617430/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
index faa947e..c41d30b 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
@@ -87,6 +87,16 @@ public class SimpleOpenWireTest extends BasicOpenWireTest {
       session.close();
    }
 
+
+   @Test
+   public void testKeepAlive() throws Exception {
+      connection.start();
+
+      Thread.sleep(125000);
+
+      connection.createSession(false, 1);
+   }
+
    @Test
    public void testSimpleTopic() throws Exception {
       connection.start();