users@glassfish.java.net

Re: MessageEndpoint per thread pooling?

From: Sivakumar Thyagarajan <Sivakumar.Thyagarajan_at_Sun.COM>
Date: Thu, 25 Jun 2009 16:29:57 +0530

Hi Henrik

Henrik Olsson wrote:
> Hello,
>
> We've implemented a Resource Adapter and seeing some suprising behaviour
> with MessageEndpoints. The MessageEndpoint proxy object returned from
> the MessageEndpointFactory seems to invoke different instances of the
> actual endpoint-object depending on which thread access the proxy
> object. Is this correct, and intended behaviour?

That does not sound correct. Could you provide more details?
I tried a simple test with one of our devtests and I see the state being
maintained on the MessageEndpoint (ie same MessageEndpoint instance
is being accessed) irrespective of which thread accesses it.

Here is some sample out to show what I am seeing. Note how count
is maintained across accesses from different threads.
> [#|2009-06-25T16:13:12.045+0530|INFO|glassfish|null|_ThreadID=71;_ThreadName=Thread-1;|[MyMessageBean] --> count = 1 onMessage:: RECEIVED [0:This is message 0:WRITE]|#]
> [#|2009-06-25T16:13:12.208+0530|INFO|glassfish|null|_ThreadID=72;_ThreadName=Thread-1;|[MyMessageBean] --> count = 2 onMessage:: RECEIVED [1:This is message 1:WRITE]|#]

Thanks
--Siva.

>
> This is kind of problematic since our RA retrieves a MessageEndpoint
> from the Factory, initializes some state on that instance, and then
> shares it with another Work instance (aka Thread), this causes calls to
> the ME-instance from the other Work instance to arrive in another
> (unitialized) instance of the MessageEndpoint.
>
> Regards,
> Henrik Olsson
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>