Re: changing the codebase attribute

Gregg Wonderly <[email protected]> Fri, 19 Jan 2007 16:17:45 -0600
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
Dominik Appl wrote:
> Hello!
>
> I am currently writing an extension for an application which will allow
> the parallel computation of some scientific models on different hosts.
> For this the Servers, on which the code will be executed, require always
> up-to-date model code. The client (and model code provider) will be
> changing from time to time. So my question is, if it is somehow possible
> to change the codebase attribute at runtime.

The RMIClassLoaderSPI provides for this capability, and the PreferredClassLoader
is the mechanism that is most easily available for you to exploit.  What you can
do, is create a new PreferredClassLoader instance in the client that indicates
the source of the client classes associated with the work request, and then
indicate the correct URL from which to download such code.  The assumption would
be that there is some interface which wouldn't change that would allow you to
access new instances of such data classes from your client using the new class
loader.  If not, then reflection would probably be necessary to construct an
instance of the data object.

Maybe you can tell us more about what the variation on the model code is and
whether there is an interface involved which doesn't change?

Gregg Wonderly

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