Re: problem w/ serialization of java.rmi.Remote pointer across HTTP through firewall

Bob Scheifler <[email protected]>
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
> I can see
> here in the client that there is definitely a DGC
> dirty call being made on the remote stub. This call
> will never succeed, because the service referenced by
> the stub is not resolvable from outside the firewall.

OK. I had asked before if client calls through the returned
stub succeeded, and I thought you said yes, but here it seems
you're saying no. (Why are you returning stubs to the client
if the client can't successfully make remote calls through them?
Does the client somehow later convert them to service addresses?)

> Is there any kind of workaround to this problem? Can
> I, on the local client, disable the DGC
> makeDirtyCall()? Can I at least change the timeout to,
> say, 1 milli? I'm on JDK 1.4.2

There's really no direct way with JRMP to disable this
dirty call. And if you return lots of stubs in a single
call, because you're using ObjectInputStream directly
(vs going through a JRMP call), you're going to suffer a
separate dirty call attempt for each one (vs having them
all bundled together in a single call). The only out I
know of with JRMP is to put a custom RMIClientSocketFactory
in each stub, e.g., one that always throws a ConnectException
or sets a very short connection timeout. That's assuming
remote calls through the stub are pointless anyway.

Another option you might consider is switching from JRMP to the
Jini extensible remote invocation (Jini ERI) implementation
of RMI. With Jini ERI you can trivially disable DGC; in fact,
it is disabled by default. You might even find with Jini ERI
that you could bury your proxy support down inside a Jini ERI
transport (or use its existing HTTP transport) and preserve
the RMI programming model for clients, rather than exposing
them to service addresses (of course you may well have other
reasons for service addresses).

- Bob

===========================================================================
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.