From d71bc421f8a7eeec3640b52dc8c93c2db5cb33f8 Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Fri, 10 Nov 2006 02:04:40 +0000 Subject: [PATCH] We should let a client change the client id on a connection even if it was set on the connection factory. git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@473167 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/activemq/ActiveMQConnection.java | 10 ++++++++++ .../org/apache/activemq/ActiveMQConnectionFactory.java | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java index 973a58fd48..44588a8df6 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java @@ -360,6 +360,16 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon this.userSpecifiedClientID = true; ensureConnectionInfoSent(); } + + /** + * Sets the default client id that the connection will use if explicitly not set with + * the setClientId() call. + */ + public void setDefaultClientID(String clientID) throws JMSException { + this.info.setClientId(clientID); + this.userSpecifiedClientID = true; + } + /** * Gets the metadata for this connection. diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java index 35f98d81f4..5ff0ac37de 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java @@ -260,7 +260,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne transport.start(); if( clientID !=null ) - connection.setClientID(clientID); + connection.setDefaultClientID(clientID); return connection; }