简体   繁体   中英

Unexporting remote objects passed as arguments in remote method call

I was wondering if there's a need to explicitly unexport a remote object passed as a parameter in a remote method call when they don't need to exist anymore. For example: I've an online game, when the client asks the GameServer(binded in a RMI registry) for a game the server returns to the client a GameHandler as a remote object. When the game is over and the GameHandler has no need to be active anymore, do I have to call UnicastRemoteObject.unexportObject(this, false); ? I'm doing it but sometimes I get a NoSuchObjectException .

It will be unexported automatically via DGC and local GC when there are no remote or local references. If you want to know when DGC has kicked in, implement the Unreferenced interface.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM