Re: smart/dynamic proxies and java 1.5

Peter Jones <[email protected]> Tue, 17 Oct 2006 02:59:21 -0400
Newsgroups gmane.comp.java.sun.rmi
Message-ID <20061017065921.GB29019@east>
On Wed, Oct 04, 2006 at 11:35:56AM -0700, Mark E. Ackerman wrote:
> Thanks Peter.
>
> The info on exporting the server pointed me in the right direction.
> I changed the export call we were using.
>
> And now it seems to work....

Good.

> I would like to get rid of the reliance on the sun classes.
>
> What we're doing to create the dynamic proxies is this:
>
> protected java.rmi.Remote getServerSideProxies(ClassLoader cl)
> {
>         java.rmi.Remote server = super.getServerSideProxies(cl);
>
>         _aServerProxy = new rma.rmi.proxy.AServerProxy( server, this);
>
>         server = (RmiFileManager) java.lang.reflect.Proxy.newProxyInstance(
>                 cl,new Class[] { RmiFileManager.class },_aServerProxy);
>         return server;
> }
>
> Where getServerSideProxies() eventually returns this, where this is
> an object that implements Remote.
>
> Then we export the Remote Object returned from
> getServerSideProxies().  There was a bunch of magic that Rickard
> figured out way back when to make it work with releases before 1.5.

The implementation of that magic is the part that I would need to know
more about in order to understand why it doesn't seem to work the same
way with JDK 5.0.

> We're also marshalling/unmarshalling data in the RMI stream for each
> RMI call through marshalCustomCallData() and
> unmarshalCustomCallData()

That is, another sun.* API dependency.  In your original post you
mentioned:

>>> One other option we're considering is moving to Jini, but with the
>>> constraints on getting the release out we don't have time to
>>> convert all our servers to Jini (unless its really easy to convert
>>> RMI Servers to Jini Servers).

FYI, the "JERI" RMI implementation included with the Jini starter kit
2.x provides public hooks for the sort of customization you're getting
with those JDK-internal marshalCustomCallData/unmarshalCustomCallData
methods (and you can just use JERI as an alternate RMI implementation
without having to convert your application more fully to a typical
Jini service style).

-- Peter

===========================================================================
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