Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

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
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 5 2002
Added on Oct 23 2002
10 comments
759 views