users@jms-spec.java.net

[jms-spec users] [jsr343-experts] Re: Clarification about JMSContext and setClientID

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Tue, 25 Jun 2013 14:00:49 +0100

I just tried to download those javadocs and got "Forbidden You don't have permission to access
/otn-pub/jcp/jms-2_0-fr-eval-spec/jms-2.0-javadoc.zip on this server.". I've reported this to the JCP admins.

Nigel

On 25/06/2013 12:05, John D. Ament wrote:
> Nigel,
>
> Seems like these javadocs are out of sync. I'll raise a separate issue.
>
> http://download.oracle.com/otndocs/jcp/jms-2_0-fr-eval-spec/index.html
>
>
> On Tue, Jun 25, 2013 at 5:07 AM, Nigel Deakin <nigel.deakin_at_oracle.com <mailto:nigel.deakin_at_oracle.com>> wrote:
>
> Clebert,
>
>
> On 24/06/2013 20:36, Clebert Suconic wrote:
>> say you created a JMSContext, and used setClientID....
>> JMSContext ctx = ...
>> ctx.setClientID("someID");
>>
>> Say, if later we call
>> JMSContext ctx2 = ctx.createJMSContext();
>
> Note that this method has one parameter, a sessionMode.
> http://docs.oracle.com/javaee/7/api/javax/jms/JMSContext.html#createContext%28int%29
>
>
>>
>> What would be the expected value of ctx2.getClientID() ?
>
> The javadocs for JMSContext#createContext(int sessionMode) say that this "creates a new |JMSContext| with the
> specified session mode using the same connection as this |JMSContext| and creating a new session. "
>
> Since the two JMSContext objects will use the same underlying connection, they have the same clientID, same
> exception listener and same connection metadata.
>
>> I'm assuming there will be some connection reused by the JMSContext and ctx.createJMSContext() would reuse the
>> internal connection as we talked earlier. I'm just double checking if this is everybody's expectations...?
>
> That's certainly my intention. The reason for this method is to allow you to create a second session on the same
> connection. The main reason for doing this is to allow you to send or receive messages using more than one thread
> at a time (but still using the same connection).
>
> The above applies only to Java SE and the Java EE application client. Applications running in the Java EE web or
> EJB container are not allowed to create more than one session per connection.This restriction dates from Java EE 6
> and probably earlier: see Java EE 6 section EE 6.7.
>
> For this reason, JMSContext#createContext(int sessionMode) is required to throw a JMSRuntimeException if called in
> the Java EE web or EJB containers. This is also why there isn't a no-parameter version of this method.
>
> Nigel
>
>>
>> Clebert
>
>