server seams loosing the reference of remote client in callback
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Amadou_Ndiaye
Posted On:   Wednesday, July 4, 2001 06:59 AM

i, I'm building an application that enables to run a code on a remote machine ;
I use an RMI server on these remote machines, and multiple clients can send job such a server ;
Execution seam working correctly, but I want to implement a callback mecanism to notify the client the end of execution.
Everything seam working except when the code execution takes more than 1mn ; It seams like
the server loose the reference of the exported object. A help will be very useful.

Thank you in advance.

Re: server seams loosing the reference of remote client in callback

Posted By:   Edward_Harned  
Posted On:   Thursday, July 5, 2001 07:41 AM

We run an RMI Client/Server environment with "callback" where the delay from the Server to the Client is 20 - 30 minutes. We also have Clients that re-call the Server
after hours of delay. NO problem.



The callback Client passes a reference to its remote object to the Server. As long as the Client does not free the remote object, then this reference is valid for the life of
the Client.



Consider this:




// new object of the Callback implementation Class CallbackImpl impl = new CallbackImpl();

try {
// make me an RMI Server
UnicastRemoteObject.exportObject(impl);
}
catch (java.rmi.RemoteException e) {
// say error
System.out.println("caught RemoteException from exportObject");

// done
return;
}

// *** kill the remote object reference ***
impl = null;



The above "kill" frees a reference to the remote object. Another reference is the reference held by the Server when you pass it to that Server. After a Server lease time-out, (see the RMI Specification, server properties, java.rmi.dgc.leaseValue)the
last reference to the Client remote object is lost and the Client Garbage Collector may free the object. Perhaps this is what is happening. Perhaps you are somehow freeing the Client's reference to the remote object. We do not know. This is only a guess.



Once again, we have no problems with holding references to remote objects.

About | Sitemap | Contact