org.jboss.ejb
Class CacheKey
java.lang.Object
|
+--org.jboss.ejb.CacheKey
- All Implemented Interfaces:
- java.io.Externalizable, java.io.Serializable
- Direct Known Subclasses:
- FastKey
- public class CacheKey
- extends java.lang.Object
- implements java.io.Externalizable
CacheKey
CacheKey is an encapsulation of both the PrimaryKey and a cache specific key
This implementation is a safer implementation in the sense that it doesn't rely
on the user supplied hashcode and equals. It is also fast since the hashCode operation
is pre-calculated.
- Version:
- $Revision: 1.12.2.1 $
- Author:
- Marc Fleury, Bill Burke, Scott Stark
- See Also:
org.jboss.ejb.plugins.NoPassivationInstanceCache.java
,
EntityInstanceCache
,
org.jboss.ejb.plugins.EntityProxy
, Serialized Form
Field Summary |
protected int |
hashCode
|
protected java.lang.Object |
id
|
protected java.rmi.MarshalledObject |
mo
|
Method Summary |
boolean |
equals(java.lang.Object object)
equals()
We base the equals on the equality of the underlying key
in this fashion we make sure that we cannot have duplicate
hashes in the maps. |
java.lang.Object |
getId()
|
int |
hashCode()
these should be overwritten by extending Cache key
since they define what the cache does in the first place |
void |
readExternal(java.io.ObjectInput in)
|
java.lang.String |
toString()
|
void |
writeExternal(java.io.ObjectOutput out)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
id
protected java.lang.Object id
mo
protected java.rmi.MarshalledObject mo
hashCode
protected int hashCode
CacheKey
public CacheKey()
CacheKey
public CacheKey(java.lang.Object id)
getId
public java.lang.Object getId()
writeExternal
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
- Specified by:
writeExternal
in interface java.io.Externalizable
readExternal
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
- Specified by:
readExternal
in interface java.io.Externalizable
hashCode
public int hashCode()
- these should be overwritten by extending Cache key
since they define what the cache does in the first place
- Overrides:
hashCode
in class java.lang.Object
equals
public boolean equals(java.lang.Object object)
- equals()
We base the equals on the equality of the underlying key
in this fashion we make sure that we cannot have duplicate
hashes in the maps.
The fast way (and right way) to do this implementation
is with a incremented cachekey. It is more complex but worth
the effort this is a FIXME (MF)
The following implementation is fool-proof
- Overrides:
equals
in class java.lang.Object
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2000 The JBoss Organization. All Rights Reserved.