activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/4] activemq-artemis git commit: new method to create ServerLocator
Date Wed, 05 Aug 2015 13:57:00 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 72b7f8271 -> 5c7720dba


new method to create ServerLocator


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

Branch: refs/heads/master
Commit: ee84d7efdf953ffce53b893d007b1aa350bb2e37
Parents: 896813f
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Wed Aug 5 09:22:41 2015 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Aug 5 09:24:22 2015 -0400

----------------------------------------------------------------------
 .../core/client/impl/ServerLocatorImpl.java     | 28 ++++++++++++++++++++
 .../jms/client/ActiveMQConnectionFactory.java   |  4 +--
 2 files changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ee84d7ef/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
index 8ed0116..64b5b92 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
@@ -19,6 +19,7 @@ package org.apache.activemq.artemis.core.client.impl;
 import java.io.ObjectStreamException;
 import java.io.Serializable;
 import java.lang.reflect.Array;
+import java.net.URI;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
@@ -48,6 +49,7 @@ import org.apache.activemq.artemis.api.core.TransportConfiguration;
 import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
 import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
 import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener;
+import org.apache.activemq.artemis.api.core.client.ServerLocator;
 import org.apache.activemq.artemis.api.core.client.TopologyMember;
 import org.apache.activemq.artemis.api.core.client.loadbalance.ConnectionLoadBalancingPolicy;
 import org.apache.activemq.artemis.core.client.ActiveMQClientLogger;
@@ -60,6 +62,7 @@ import org.apache.activemq.artemis.core.remoting.FailureListener;
 import org.apache.activemq.artemis.spi.core.remoting.ClientProtocolManager;
 import org.apache.activemq.artemis.spi.core.remoting.ClientProtocolManagerFactory;
 import org.apache.activemq.artemis.spi.core.remoting.Connector;
+import org.apache.activemq.artemis.uri.ServerLocatorParser;
 import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
 import org.apache.activemq.artemis.utils.ClassloadingUtil;
 import org.apache.activemq.artemis.utils.UUIDGenerator;
@@ -471,6 +474,31 @@ public final class ServerLocatorImpl implements ServerLocatorInternal,
Discovery
       clusterConnection = false;
    }
 
+   public static ServerLocator newLocator(String uri)
+   {
+      try
+      {
+         return newLocator(new URI(uri));
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   public static ServerLocator newLocator(URI uri)
+   {
+      try
+      {
+         ServerLocatorParser parser = new ServerLocatorParser();
+         return parser.newObject(uri, null);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
    /**
     * Create a ServerLocatorImpl using UDP discovery to lookup cluster
     */

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ee84d7ef/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
index 1a84830..0630876 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionFactory.java
@@ -47,6 +47,7 @@ import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
 import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
 import org.apache.activemq.artemis.api.core.client.ServerLocator;
 import org.apache.activemq.artemis.api.jms.JMSFactoryType;
+import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
 import org.apache.activemq.artemis.jms.referenceable.ConnectionFactoryObjectFactory;
 import org.apache.activemq.artemis.jms.referenceable.SerializableObjectRefAddr;
 import org.apache.activemq.artemis.uri.ConnectionFactoryParser;
@@ -162,11 +163,10 @@ public class ActiveMQConnectionFactory implements Externalizable, Referenceable,
    public ActiveMQConnectionFactory(String url)
    {
       ConnectionFactoryParser cfParser = new ConnectionFactoryParser();
-      ServerLocatorParser locatorParser = new ServerLocatorParser();
       try
       {
          URI uri = new URI(url);
-         serverLocator = locatorParser.newObject(uri, null);
+         serverLocator = ServerLocatorImpl.newLocator(uri);
          cfParser.populateObject(uri, this);
       }
       catch (Exception e)


Mime
View raw message