Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2D84618AC9 for ; Wed, 5 Aug 2015 13:57:04 +0000 (UTC) Received: (qmail 28967 invoked by uid 500); 5 Aug 2015 13:57:01 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 28914 invoked by uid 500); 5 Aug 2015 13:57:01 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 28901 invoked by uid 99); 5 Aug 2015 13:57:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Aug 2015 13:57:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DBEEEDFBA7; Wed, 5 Aug 2015 13:57:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: clebertsuconic@apache.org To: commits@activemq.apache.org Date: Wed, 05 Aug 2015 13:57:00 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/4] activemq-artemis git commit: new method to create ServerLocator 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 Authored: Wed Aug 5 09:22:41 2015 -0400 Committer: Clebert Suconic 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)