RMI distributed garbage collection and custom socket factories
843793Mar 4 2003 — edited Mar 12 2003I have a question regarding RMI's distributed garbage collection system and custom socket factories: do the GC Daemon server object and DGCClient object use the global socket factories set with RMISocketFactory.setSocketFactory()?
I'm working on a client that connects to 2 separate servers (separate JVMs). The first server uses the RMISocketFactory.setSocketFactory() to set the global socket factory to our own custom socket factory. The second server is new, and we did not want to change the global socket factory. Instead, we wanted to specify our custom socket factories when we export objects from the second JVM.
The problem is the distributed garbage collection system does not seem to work with the second server. It appears that the DGCClient is picking up the global socket factory (our custom socket factory), while I'm guessing the GC Daemon in the server JVM uses Sun's default socket factory. Unfortunately our custom socket factory creates sockets that aren't compatible with plain sockets. Ironically we don't need to rely on the distributed garbage collection system, but when it fails our method calls to our server objects start to fail with UnmarshalExceptions.
So this is what I'm wondering:
a) Is there some way to work around this without setting the global socket factory in the second JVM and continue to use the global socket factory in the client and first JVM?
b) When exceptions happen in RMI runtime, sometimes it seems difficult to know exactly what is causing the problem. Is there any documentation out there that explains for a given exception, some specific reasons it failed?
Sorry about the wordy post, but thanks for any suggestions!