users@glassfish.java.net

Re: EJB3 Remote Referece Thread Safe?

From: <glassfish_at_javadesktop.org>
Date: Fri, 17 Oct 2008 00:03:42 PDT

First af all, thanks a lot for your time and your samples.

The good news are that the client is still alive, and the damn CORBA Exception has not raised for 2 days.

My test environment, has really two clients that are making a call to the same ejb3 remote method every 30 seconds since they were started (I've implemented this using a Timer). The first client does just one lookup, and usues the EJB3 remote reference through the entire live of the application. The second client (based on your suggestion), performs a lookup each time it needs to call a method, i.e. gets a "fresh reference" every 30 seconds.

Well, let's comment the results: The first client gets random CORBA Exception (I've already put the stack trace before), so the call is blocked until the exception is rised (30 minute!!!). The second client is still alive since the first run (2 days till now) and of course has not suffer from any weird exception.

I do not know the reason, but it's just that simple to reproduce the problem. And the workaround of getting a fresh reference is good, but I'm just wondering if there could be an issue with this procedure of getting a "fresh reference" each time you need to call a method. Notice two things:
 1. The client lives forever, it's a monitoring app that needs to be up always.
 2. I can`t do the same you do, Witold, because you have very clear when you need to get a "fresh reference" (new child window pops up), and when you have to dispose it (child window closes). In my application the main frame window has to call remote ejb methods in response of 3 things:
  - User interaction ----> Indeterminate time
  - JMS message reception ----> Indeterminate time
  - A Timer ----> Determinate time
...so when should I get the "fresh reference"?:
   - Every time ----> Ok if no problems according to multiple lookups of the same reference (each time i need to call a method)
   - Every n seconds or every n calls ----> Problem, because perhaps "n-1" or "n-2" or "n",...is the call that gets the damn exception, and blocks (30 minutes default!)
[Message sent by forum member 'abelmj' (abelmj)]

http://forums.java.net/jive/thread.jspa?messageID=308611