| CONTENTS | PREV | NEXT | Java Remote Method Invocation |
In order for a remote object to be used as a key in a hash table, the methodsequalsandhashCodeare overridden by the java.rmi.server.RemoteObject class:
- The java.rmi.server.RemoteObject class's implementation of the
equalsmethod 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 ofequalsdoes not allow a remote exception to be thrown.- The java.rmi.server.RemoteObject class's implementation of the
hashCodemethod 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).