Re: equals and hasCode for InvocationLayerFactory implementations
Mark Brouwer <[email protected]>
| Newsgroups | gmane.comp.java.sun.jini |
|---|---|
| Message-ID | <[email protected]> |
Peter Jones wrote: > On Mon, Feb 12, 2007 at 12:56:16PM +0100, Mark Brouwer wrote: >> Is there a need for equals and hashCode for an InvocationLayerFactory >> implementation, I see various implementations in net.jini.jeri have them >> but I can't seem to find the spec that demand them or any usage of them >> that would make it obvious they should be there? > > It is not a specification requirement, nor is it an operational > requirement in any way that I can recall. > > I suspect that the net.jini.jeri *ILFactory classes have > hashCode/equals methods because those classes represent immutable > objects whose identity is unimportant and that contain data that can > be compared with equals, so it was straightforward for them to do > that. BasicILFactory appears to have had hashCode/equals methods > since it was first created. Perhaps there was a reason that I don't > remember. Thanks Peter, and in case you wondered why the hell is someone bothered with this. I extended BasicILFactory and mine is not immutable as the InvocationDispatchers created by the factory have support for access control and remote method invocation throttling that can be modified at runtime. This is done by modifying the factory which will take care all dispatchers created by the factory will be modified accordingly. The fact BasicILFactory has equals and hashCode kind of forced me to override them as well, but now that I now I can ignore that. -- Mark -------------------------------------------------------------------------- Getting Started: http://www.jini.org/wiki/Category:Getting_Started Community Web Site: http://jini.org jini-users Archive: http://archives.java.sun.com/archives/jini-users.html Unsubscribing: email "signoff JINI-USERS" to [email protected]