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
This commit is contained in:
Hiram R. Chirino 2006-11-10 02:04:40 +00:00
parent 0918fba384
commit d71bc421f8
2 changed files with 11 additions and 1 deletions

View File

@ -360,6 +360,16 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
this.userSpecifiedClientID = true; this.userSpecifiedClientID = true;
ensureConnectionInfoSent(); 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. * Gets the metadata for this connection.

View File

@ -260,7 +260,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
transport.start(); transport.start();
if( clientID !=null ) if( clientID !=null )
connection.setClientID(clientID); connection.setDefaultClientID(clientID);
return connection; return connection;
} }