users@glassfish.java.net

Re: EJB3 Remote Referece Thread Safe?

From: Witold Szczerba <pljosh.mail_at_gmail.com>
Date: Thu, 16 Oct 2008 16:52:28 +0200

2008/10/16 <glassfish_at_javadesktop.org>:
>>What do you mean by "always refresh reference"?
>
> Supose that you need to call, [b]very often[/b], ejb3 remote methods from a main frame window, i.e. the window that will be "alive" through the entire live of the application. I this case, you need to get a "fresh reference" (via the way you desire, but all these would lead to a lookup = fresh reference) each time you call a method, in order to follow your implementation:

Well, you can also do the same thing I did - with intercepting
methods. In my case, when one invokes:
Services.get(SomeServiceRemote.class)
I am looking up an object and then wraps it with my special
interceptor and return something like a proxy.

When you call a business method on that object, it is intercepted.
When EJB exception is catched (do not remember which exactly), I am
(under the hood) looking up that object again and reinvoke that method
again (there is only one retry in my implementation). if secound
invocation fails, I am giving up and throwing an exception.

So, there is no unnecessary look up when everything is ok, and up to 1
retry when something goes wrong.

Regards,
Witold Szczerba

>>>I am creating reference only when I have to perform some action on particular
>>>session bean it and throw it away when it is not needed.
> [Message sent by forum member 'abelmj' (abelmj)]
>
> http://forums.java.net/jive/thread.jspa?messageID=308071
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>