From 4b79ddb0bd02f0a6913beb2f5d7aabf350933543 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Tue, 25 Aug 2015 18:20:59 -0400 Subject: [PATCH] ARTEMIS-209 fix keepAlive - Received should be set to true on any package --- .../artemis/core/protocol/openwire/OpenWireConnection.java | 5 +++-- .../core/protocol/openwire/OpenWireProtocolManager.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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 abe7cdff79..c5644dd04c 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 @@ -124,7 +124,7 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor { private final Object sendLock = new Object(); - private boolean dataReceived; + private volatile boolean dataReceived; private OpenWireFormat wireFormat; @@ -198,6 +198,8 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor { @Override public void bufferReceived(Object connectionID, ActiveMQBuffer buffer) { try { + dataReceived = true; + Command command = (Command) wireFormat.unmarshal(buffer); boolean responseRequired = command.isResponseRequired(); @@ -205,7 +207,6 @@ 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; info.setResponseRequired(false); // if we don't respond to KeepAlive commands then the client will think the server is dead and timeout diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java index fa75fcfc33..2554ce11dc 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java @@ -351,7 +351,7 @@ public class OpenWireProtocolManager implements ProtocolManager, No String id = getBrokerId() != null ? getBrokerId().getValue() : "NOT_SET"; advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_ORIGIN_BROKER_ID, id); - String url = "tcp://localhost:61616"; + String url = context.getConnection().getLocalAddress(); advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_ORIGIN_BROKER_URL, url);