tags:

views:

30

answers:

1

How can I test if my reference to an remote object is still alive?

+1  A: 

Call any method on the object. A RemoteException will be thrown if the object is not alive.

Thierry-Dimitri Roy
Would calling hashCode() trigger a RuntimeException?
ktrrr
Call any remote method on the object. That will tell you if it is reachable.
Romain Hippeau
No. A NoSuchObjectException will be thrown if the object is not alive, and that's not a RuntimeException, it's a RemoteException.
EJP
@EJP: Good catch
Thierry-Dimitri Roy