activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martyntay...@apache.org
Subject activemq-artemis git commit: Revert "Changing the way to interact with JGroups in the ResourceAdapter"
Date Thu, 24 Aug 2017 09:27:00 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 16eca68bf -> fcce3bac2


Revert "Changing the way to interact with JGroups in the ResourceAdapter"

This reverts commit 2493158d1168bd6a93cafbecab68ba6c19901061.

This is causing some problems with the classloader used in the RA,
resulting in NPEs.  Reverting this.  We can revist when we have a more
stable solution.


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

Branch: refs/heads/master
Commit: fcce3bac2a78fe57775d56e38425354f5ca7f0c9
Parents: 16eca68
Author: Martyn Taylor <mtaylor@redhat.com>
Authored: Thu Aug 24 10:24:40 2017 +0100
Committer: Martyn Taylor <mtaylor@redhat.com>
Committed: Thu Aug 24 10:26:37 2017 +0100

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


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fcce3bac/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 47c95bf..bc2b42f 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.apache.activemq.artemis.api.core.BroadcastEndpointFactory;
+import org.jgroups.JChannel;
 
 /**
  * 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 BroadcastEndpointFactory object.
As is impossible with
-    * JCA, we use this method to allow a BroadcastEndpointFactory object to be located.
+    * 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.
     */
-   public static BroadcastEndpointFactory locateBroadcastEndpointFactory(final String locatorClass,
final String name) {
-      return AccessController.doPrivileged(new PrivilegedAction<BroadcastEndpointFactory>()
{
+   public static JChannel locateJGroupsChannel(final String locatorClass, final String name)
{
+      return AccessController.doPrivileged(new PrivilegedAction<JChannel>() {
          @Override
-         public BroadcastEndpointFactory run() {
+         public JChannel run() {
             try {
                ClassLoader loader = Thread.currentThread().getContextClassLoader();
                Class<?> aClass = loader.loadClass(locatorClass);
                Object o = aClass.newInstance();
-               Method m = aClass.getMethod("locateBroadcastEndpointFactory", new Class[]{String.class});
-               return (BroadcastEndpointFactory) m.invoke(o, name);
+               Method m = aClass.getMethod("locateChannel", new Class[]{String.class});
+               return (JChannel) 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/fcce3bac/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 9812980..bd4b8c9 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,6 +42,7 @@ 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;
@@ -60,6 +61,7 @@ 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
@@ -1714,7 +1716,8 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
{
 
          if (jgroupsLocatorClassName != null) {
             String jchannelRefName = raProperties.getJgroupsChannelRefName();
-            endpointFactory = ActiveMQRaUtils.locateBroadcastEndpointFactory(jgroupsLocatorClassName,
jchannelRefName);
+            JChannel jchannel = ActiveMQRaUtils.locateJGroupsChannel(jgroupsLocatorClassName,
jchannelRefName);
+            endpointFactory = new ChannelBroadcastEndpointFactory(jchannel, jgroupsChannel);
          } else if (discoveryAddress != null) {
             Integer discoveryPort = overrideProperties.getDiscoveryPort() != null ? overrideProperties.getDiscoveryPort()
: getDiscoveryPort();
             if (discoveryPort == null) {
@@ -1814,7 +1817,8 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
{
             String jgroupsLocatorClass = raProperties.getJgroupsChannelLocatorClass();
             if (jgroupsLocatorClass != null) {
                String jgroupsChannelRefName = raProperties.getJgroupsChannelRefName();
-               endpointFactory = ActiveMQRaUtils.locateBroadcastEndpointFactory(jgroupsLocatorClass,
jgroupsChannelRefName);
+               JChannel jchannel = ActiveMQRaUtils.locateJGroupsChannel(jgroupsLocatorClass,
jgroupsChannelRefName);
+               endpointFactory = new ChannelBroadcastEndpointFactory(jchannel, jgroupsChannel);
             }
             if (endpointFactory == null) {
                throw new IllegalArgumentException("must provide either TransportType or DiscoveryGroupAddress
and DiscoveryGroupPort for ResourceAdapter Connection Factory");


Mime
View raw message