CONTENTS | PREV | NEXT | Java Remote Method Invocation |
In order for a remote object to be used as a key in a hash table, the methodsequals
andhashCode
are overridden by the java.rmi.server.RemoteObject class:
- The java.rmi.server.RemoteObject class's implementation of the
equals
method determines whether two object references are equal, not whether the contents of the two objects are equal. This is because determining equality based on content requires a remote method invocation, and the signature ofequals
does not allow a remote exception to be thrown.- The java.rmi.server.RemoteObject class's implementation of the
hashCode
method returns the same value for all remote references that refer to the same underlying remote object (because references to the same object are considered equal).