I have a remote object which implements its own version of equals
and hashcode. The hashcode value is the same for all instances of the
class. The equals will compare equal if the state of the two objects
are equal. With RMI, I can get back the stub to the wrong object in the
following scenario:
- - Client calls factory(other object I use to create objects) method on
server to create object which I will call "A".
- - Client calls factory method on server to create object "B".
- - Client then calls factory to get object "A". What is actually
returned is the stub to object "B".
Since I have access to the RMI source, I looked to see that the equals
method of WeakRef is called when the objects are stored into the
hashtable. The equals method of WeakRef will call the equals on the
actual objects? It seems like it would be more appropriate(and faster)
for the equals of WeakRef to compare the references for equal rather
than invoke the equals method.
and hashcode. The hashcode value is the same for all instances of the
class. The equals will compare equal if the state of the two objects
are equal. With RMI, I can get back the stub to the wrong object in the
following scenario:
- - Client calls factory(other object I use to create objects) method on
server to create object which I will call "A".
- - Client calls factory method on server to create object "B".
- - Client then calls factory to get object "A". What is actually
returned is the stub to object "B".
Since I have access to the RMI source, I looked to see that the equals
method of WeakRef is called when the objects are stored into the
hashtable. The equals method of WeakRef will call the equals on the
actual objects? It seems like it would be more appropriate(and faster)
for the equals of WeakRef to compare the references for equal rather
than invoke the equals method.