[ 
https://issues.apache.org/jira/browse/ARTEMIS-1206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16037145#comment-16037145
 ] 

Timothy Bish commented on ARTEMIS-1206:
---------------------------------------

{noformat}
void setClientID(String clientID)
                 throws JMSException

Sets the client identifier for this connection.

The preferred way to assign a JMS client's client identifier is for it to be 
configured in a client-specific ConnectionFactory object and transparently 
assigned to the Connection object it creates.

Alternatively, a client can set a connection's client identifier using a 
provider-specific value. The facility to set a connection's client identifier 
explicitly is not a mechanism for overriding the identifier that has been 
administratively configured. It is provided for the case where no 
administratively specified identifier exists. If one does exist, an attempt to 
change it by setting it must throw an IllegalStateException. If a client sets 
the client identifier explicitly, it must do so immediately after it creates 
the connection and before any other action on the connection is taken. After 
this point, setting the client identifier is a programming error that should 
throw an IllegalStateException.

The purpose of the client identifier is to associate a connection and its 
objects with a state maintained on behalf of the client by a provider. The only 
such state identified by the JMS API is that required to support durable 
subscriptions.

If another connection with the same clientID is already running when this 
method is called, the JMS provider should detect the duplicate ID and throw an 
InvalidClientIDException.

This method must not be used in a Java EE web or EJB application. Doing so may 
cause a JMSException to be thrown though this is not guaranteed.

Parameters:
    clientID - the unique client identifier
Throws:
    JMSException - if the JMS provider fails to set the client ID for the the 
connection for one of the following reasons:

        an internal error has occurred or
        this method has been called in a Java EE web or EJB application (though 
it is not guaranteed that an exception is thrown in this case) 

    InvalidClientIDException - if the JMS client specifies an invalid or 
duplicate client ID.
    IllegalStateException - if the JMS client attempts to set a connection's 
client ID at the wrong time or when it has been administratively configured.
{noformat}

> [Core JMS Client] Violates JMS Specification - allows two active connections 
> with same clientid
> -----------------------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-1206
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1206
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Michael Andre Pearce
>         Attachments: JMSDurableConsumerTest2.java
>
>
> Currently it is possible to make two completely separate client connections 
> to the broker, with the same client id.
> This was found/raised as a possible bug in Core Client on looking at 
> differing behaviours between the Core JMS Client and the Qpid AMQP Client.
> https://issues.apache.org/jira/browse/ARTEMIS-1205
> Attached is a test case, where by the Qpid Client errors, and the Core Client 
> does not, executing the same client code.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to