How could i know that when rmi client disconnect
843793Oct 23 2002 — edited Nov 7 2002
I have one thread that will be in a long time loop operation when rmi client invoke it. How could i know when rmi client has been interrupted and then stop such thread.
Thank your help so much.
e.g.
//rmi interface
public interface MServer extends java.rmi.Remote{
Object fetchResult(String id);
}
//implements
public class MServerImpl extends java.rmi.server.UnicastRemoteObject implements MServer{
public Object fetchResult(String id) throws RemoteException {
long money=0;
do{
money++;
if(rmiClientInterrupted())
return id + ": Honey, don't go!";
if(money>100000000000000000)
return id + ": Honey, you've got " + money + " $.";
}while(true);
}
public boolean rmiClientInterrupted(){
//????
//How to test rmi client's context status
//????
}
//So other method
}