Re: What causes an object to be removed from the ObjectTable?
Niclas Hedhman <[email protected]> Sun, 18 Dec 2005 09:29:23 +0800
| Newsgroups | gmane.comp.java.sun.rmi |
|---|---|
| Organization | Independent |
| Message-ID | <[email protected]> |
On Sunday 18 December 2005 00:45, Robert DiFalco wrote: > I may be missing your point, but #exportObject is called in the > UnicastRemoteObject constructor. All this does is create a target and > add it to the ObjectTable anchored by a WeakReference. To keep that from > being reaped, I would think you also need to keep a strong link to > "this", say by binding it to the registry. Personally, I think Peter might be right that this is related to bug_id=4114579. Perhaps using Unreferenced could also shed additional light. Personally, I use a general pattern for remote singletons which includes a "lifecycle contract" for both initialization and disposal. And during those I do explicit URO.exportObject() and URO.unexportObject() (and my objects typically don't extend from URO either (downside == equals/hashCode becomes tricky). More generic advice; Don't rely on that either the networking nor any part of RMI to not make mistakes (especially in border cases). Essentially, by making the codebase "robust" and recoverable from failures. JINI is of course the ultimate choice. Perhaps your issue here is related to making such robustness, and you need to detect the loss of the service. "Unreferenced" is your friend here. So, I would suggest; Keep strong references to your Remote objects, and manage the lifecycle of them with explicit exportObject() and unexportObject() calls. Cheers Niclas =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff RMI-USERS". For general help, send email to [email protected] and include in the body of the message "help". For a list of frequently asked RMI questions please refer to: http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html To view past RMI-USERS postings, please see: http://archives.java.sun.com/archives/rmi-users.html