You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ma...@apache.org on 2017/08/23 14:19:20 UTC

[1/2] activemq-artemis git commit: Changing the way to interact with JGroups in the ResourceAdapter

Repository: activemq-artemis
Updated Branches:
  refs/heads/master cf8b42a14 -> a2602cb52


Changing the way to interact with JGroups in the ResourceAdapter

Obtaining a BroadCastEndpointFactory instead of a JChannel to connect to JGroups to avoid issue and leak with JChannel lifecyle.


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

Branch: refs/heads/master
Commit: 2493158d1168bd6a93cafbecab68ba6c19901061
Parents: cf8b42a
Author: Emmanuel Hugonnet <em...@gmail.com>
Authored: Wed Aug 23 15:57:28 2017 +0200
Committer: Emmanuel Hugonnet <em...@gmail.com>
Committed: Wed Aug 23 16:08:34 2017 +0200

----------------------------------------------------------------------
 .../apache/activemq/artemis/ra/ActiveMQRaUtils.java | 16 ++++++++--------
 .../artemis/ra/ActiveMQResourceAdapter.java         |  8 ++------
 2 files changed, 10 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2493158d/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java
index bc2b42f..47c95bf 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java
@@ -27,7 +27,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
-import org.jgroups.JChannel;
+import org.apache.activemq.artemis.api.core.BroadcastEndpointFactory;
 
 /**
  * Various utility functions
@@ -236,19 +236,19 @@ public final class ActiveMQRaUtils {
 
    /**
     * Within AS7 the RA is loaded by JCA. properties can only be passed in String form. However if
-    * RA is configured using jgroups stack, we need to pass a Channel object. As is impossible with
-    * JCA, we use this method to allow a JChannel object to be located.
+    * RA is configured using jgroups stack, we need to pass a BroadcastEndpointFactory object. As is impossible with
+    * JCA, we use this method to allow a BroadcastEndpointFactory object to be located.
     */
-   public static JChannel locateJGroupsChannel(final String locatorClass, final String name) {
-      return AccessController.doPrivileged(new PrivilegedAction<JChannel>() {
+   public static BroadcastEndpointFactory locateBroadcastEndpointFactory(final String locatorClass, final String name) {
+      return AccessController.doPrivileged(new PrivilegedAction<BroadcastEndpointFactory>() {
          @Override
-         public JChannel run() {
+         public BroadcastEndpointFactory run() {
             try {
                ClassLoader loader = Thread.currentThread().getContextClassLoader();
                Class<?> aClass = loader.loadClass(locatorClass);
                Object o = aClass.newInstance();
-               Method m = aClass.getMethod("locateChannel", new Class[]{String.class});
-               return (JChannel) m.invoke(o, name);
+               Method m = aClass.getMethod("locateBroadcastEndpointFactory", new Class[]{String.class});
+               return (BroadcastEndpointFactory) m.invoke(o, name);
             } catch (Throwable e) {
                ActiveMQRALogger.LOGGER.debug(e.getMessage(), e);
                return null;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2493158d/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java
index bd4b8c9..9812980 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java
@@ -42,7 +42,6 @@ import java.util.regex.Pattern;
 
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.BroadcastEndpointFactory;
-import org.apache.activemq.artemis.api.core.ChannelBroadcastEndpointFactory;
 import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
 import org.apache.activemq.artemis.api.core.JGroupsFileBroadcastEndpointFactory;
 import org.apache.activemq.artemis.api.core.Pair;
@@ -61,7 +60,6 @@ import org.apache.activemq.artemis.service.extensions.ServiceUtils;
 import org.apache.activemq.artemis.service.extensions.xa.recovery.XARecoveryConfig;
 import org.apache.activemq.artemis.utils.SensitiveDataCodec;
 import org.jboss.logging.Logger;
-import org.jgroups.JChannel;
 
 /**
  * The resource adapter for ActiveMQ
@@ -1716,8 +1714,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
 
          if (jgroupsLocatorClassName != null) {
             String jchannelRefName = raProperties.getJgroupsChannelRefName();
-            JChannel jchannel = ActiveMQRaUtils.locateJGroupsChannel(jgroupsLocatorClassName, jchannelRefName);
-            endpointFactory = new ChannelBroadcastEndpointFactory(jchannel, jgroupsChannel);
+            endpointFactory = ActiveMQRaUtils.locateBroadcastEndpointFactory(jgroupsLocatorClassName, jchannelRefName);
          } else if (discoveryAddress != null) {
             Integer discoveryPort = overrideProperties.getDiscoveryPort() != null ? overrideProperties.getDiscoveryPort() : getDiscoveryPort();
             if (discoveryPort == null) {
@@ -1817,8 +1814,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
             String jgroupsLocatorClass = raProperties.getJgroupsChannelLocatorClass();
             if (jgroupsLocatorClass != null) {
                String jgroupsChannelRefName = raProperties.getJgroupsChannelRefName();
-               JChannel jchannel = ActiveMQRaUtils.locateJGroupsChannel(jgroupsLocatorClass, jgroupsChannelRefName);
-               endpointFactory = new ChannelBroadcastEndpointFactory(jchannel, jgroupsChannel);
+               endpointFactory = ActiveMQRaUtils.locateBroadcastEndpointFactory(jgroupsLocatorClass, jgroupsChannelRefName);
             }
             if (endpointFactory == null) {
                throw new IllegalArgumentException("must provide either TransportType or DiscoveryGroupAddress and DiscoveryGroupPort for ResourceAdapter Connection Factory");


[2/2] activemq-artemis git commit: This closes #1489

Posted by ma...@apache.org.
This closes #1489


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

Branch: refs/heads/master
Commit: a2602cb52b132f675f3f230df4051c0a22f47d6c
Parents: cf8b42a 2493158
Author: Martyn Taylor <mt...@redhat.com>
Authored: Wed Aug 23 15:18:19 2017 +0100
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Wed Aug 23 15:18:19 2017 +0100

----------------------------------------------------------------------
 .../apache/activemq/artemis/ra/ActiveMQRaUtils.java | 16 ++++++++--------
 .../artemis/ra/ActiveMQResourceAdapter.java         |  8 ++------
 2 files changed, 10 insertions(+), 14 deletions(-)
----------------------------------------------------------------------