File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes toString and equals as remote methods... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "toString and equals as remote methods... " Watch "toString and equals as remote methods... " New topic

toString and equals as remote methods...

James Turner
Ranch Hand

Joined: May 10, 2004
Posts: 194
Does anyone know how it is possible to make a call to toString and equals and have them be from the Remote Object and not it's stub?

Any help is greatly appreciated.


James<br />SCJP 1.4 - 92%<br />SCJD - 93%<br />SCWCD 1.4 - 95%<br />SCBCD 1.3 - 100%<br />SCEA - 92%
Joakim Eriksson

Joined: Sep 13, 2004
Posts: 25
usually you have one remote rmi server.
It serves objects from the remote databse.
Once recieved these objects have no connection to the remote data.

Another way is to have the rmi server serve you objects that are still
connected to the remote data. This is done via a "Factory".
In effect every object you recieve from the factory is bound in the registry and is in itself a rmi server.
A "toString()" from this object would then reflect the data currently on the server and not only local changes. changes to this object would also change the remote objects state.

If you track references handed out to the objects and also "return them" by some method before disposing them, they could also be unbound when they are not referenced any more.
It is described in detail in [W.Grosso,"Java RMI", O'Reilley, 2002, pp.377-382]

Hope it helps

I agree. Here's the link:
subject: toString and equals as remote methods...
It's not a secret anymore!