Do classes implementing Remote interfaces need to be Serializable?

Peter-Frank Spierenburg <[email protected]> Wed, 27 Sep 2006 17:46:03 -0600
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
Greetings,

 

I am trying to design a simple database server application using RMI. On
the server I have a Database object, a SessionFactoryImpl instance, and
several SessionImpl objects (one per client). The client uses the
rmiregistry to locate the SessionFactory instance, and request a Session
instance. From then on the client will use the Session to communicate
with the server. My intention is that the client only should get access
to instances of SessionFactoryImpl_Stub and SessionImpl_Stub. All the
examples that I have seen on the web however, use subclasses of
UnicastRemoteObject which is Serializable. My fear is that the client
can get hold of a SessionFactoryImpl or SessionImpl instance instead of
the corresponding stub. Is this possible, or is UnicastRemoteObject
responsible for ensuring that all nonlocal references to it are stubs?

 

Peter-Frank Spierenburg.

 


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