-
1. Re: Detecting if a remote reference is still valid
juha Jan 5, 2004 6:53 AM (in response to stefano_fornari)If the server crashes the session state is gone, unless you implement your own persistence and recovery mechanism. Otherwise you have no choice but to recreate the session or set up a cluster with session failover.
Sessions are passivated to disk after a timeout, and eventually cleaned up from disk once they expire. Set the expiration value long enough for the user to return from their lunch (say 1 week), it's not using any server resources if the session is inactive (it's just sitting on the disk). -
2. Re: Detecting if a remote reference is still valid
milowe Jan 7, 2004 9:06 AM (in response to stefano_fornari)And once again; you can check if your reference is valid by using getHandle() (will throw RemoteException if not valid).
-
3. Re: Detecting if a remote reference is still valid
juha Jan 7, 2004 3:33 PM (in response to stefano_fornari)Have you tried it? As far as I can remember getHandle() implementation doesn't try to connect to the server. You'd have to do getHandle().getEJBObject() at least. And that implies JNDI lookup and downloading a new proxy instance to the client so you really don't want to be doing that all over the place.
-
4. Re: Detecting if a remote reference is still valid
milowe Jan 9, 2004 2:34 AM (in response to stefano_fornari)A bit sloppy in my comment. Yes, I do use getEJBObject() on my Handle.
This solution works fine for me since this session is not accessed that frequently. -
5. Re: Detecting if a remote reference is still valid
stefano_fornari Jan 10, 2004 5:18 AM (in response to stefano_fornari)Thanks to everybody.
Too bad there is not a standardized way. The getHandle().getObject() method is clever, but for my purpose overkilling. I prefere to add a business delegate that intercepts RMIException and handles it accordingly (getting a new object if necessary and possible).