Repository: activemq-artemis
Updated Branches:
  refs/heads/master 6e8832b6c -> dd0bd97b8


ARTEMIS-697 Avoid self-discovery

This avoids an issue where a broker would discover itself, causing an 
unexpected behavior when using
core bridges to forward messages:
   * Make channel manager a singleton ensuring that only one channel with a 
given name exists
   * Ensure that messages are marked with NON_LOOPBACK to avoid receiving 
messages originating from
     itself


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

Branch: refs/heads/master
Commit: bf4796c5d30d90b46b22764d638fc074c026b4b9
Parents: 6e8832b
Author: Ulf Lilleengen <l...@redhat.com>
Authored: Thu Aug 18 15:46:09 2016 +0200
Committer: Clebert Suconic <clebertsuco...@apache.org>
Committed: Wed Aug 24 17:06:55 2016 -0400

----------------------------------------------------------------------
 .../apache/activemq/artemis/api/core/jgroups/JChannelManager.java  | 2 +-
 .../apache/activemq/artemis/api/core/jgroups/JChannelWrapper.java  | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bf4796c5/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelManager.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelManager.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelManager.java
index f594c07..1db4327 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelManager.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelManager.java
@@ -34,7 +34,7 @@ public class JChannelManager {
 
    private static final Logger logger = 
Logger.getLogger(JChannelManager.class);
 
-   private Map<String, JChannelWrapper> channels;
+   private static Map<String, JChannelWrapper> channels;
 
    public synchronized JChannelWrapper getJChannel(String channelName,
                                                    JGroupsBroadcastEndpoint 
endpoint) throws Exception {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bf4796c5/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelWrapper.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelWrapper.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelWrapper.java
index 7d64dd4..eb61ffb 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelWrapper.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelWrapper.java
@@ -22,6 +22,7 @@ import java.util.List;
 
 import org.jboss.logging.Logger;
 import org.jgroups.JChannel;
+import org.jgroups.Message;
 import org.jgroups.ReceiverAdapter;
 
 /**
@@ -127,6 +128,7 @@ public class JChannelWrapper {
 
    public void send(org.jgroups.Message msg) throws Exception {
       if (logger.isTraceEnabled()) logger.trace(this + "::Sending JGroups 
Message: Open=" + channel.isOpen() + " on channel " + channelName + " msg=" + 
msg);
+      msg.setTransientFlag(Message.TransientFlag.DONT_LOOPBACK);
       channel.send(msg);
    }
 

Reply via email to