|
EclipseLink 1.2.0, build 'v20091016-r5565' API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.sessions.interceptors.CacheInterceptor
public abstract class CacheInterceptor
Purpose: Define a class through which Cache access can be intercepted.
Description: EclipseLink makes extensive use of caching functionality. This class provides the mechanism for intercepting the cache access. Once intercepted applications can allow the process to continue by calling the method on the class attribute targetIdentityMap as described in the API javadocs or redirect the process entirely. * As with IdentityMaps an entire class inheritance heirachy will share the same interceptor.
To implement a CacheInterceptor users should subclass this class implementing those methods they wish to intercept.
Configuration: Interceptors may be added to a session by using a Session or Descriptor customizer to set the class name of the interceptor on the target ClassDescriptor through the method setCacheInterceptorClass(Class).
Field Summary | |
---|---|
protected org.eclipse.persistence.internal.sessions.AbstractSession |
interceptedSession
|
protected org.eclipse.persistence.internal.identitymaps.IdentityMap |
targetIdentityMap
This attribute stores the actual IdentityMap as configured by the user. |
Constructor Summary | |
---|---|
CacheInterceptor(org.eclipse.persistence.internal.identitymaps.IdentityMap targetIdentityMap,
org.eclipse.persistence.internal.sessions.AbstractSession interceptedSession)
|
Method Summary | |
---|---|
org.eclipse.persistence.internal.identitymaps.CacheKey |
acquireDeferredLock(java.util.Vector primaryKey)
Acquire a deferred lock on the object. |
org.eclipse.persistence.internal.identitymaps.CacheKey |
acquireLock(java.util.Vector primaryKey,
boolean forMerge)
Acquire an active lock on the object. |
org.eclipse.persistence.internal.identitymaps.CacheKey |
acquireLockNoWait(java.util.Vector primaryKey,
boolean forMerge)
Acquire an active lock on the object, if not already locked. |
org.eclipse.persistence.internal.identitymaps.CacheKey |
acquireLockWithWait(java.util.Vector primaryKey,
boolean forMerge,
int wait)
Acquire an active lock on the object, if not already locked. |
org.eclipse.persistence.internal.identitymaps.CacheKey |
acquireReadLockOnCacheKey(java.util.Vector primaryKey)
Acquire a read lock on the object. |
org.eclipse.persistence.internal.identitymaps.CacheKey |
acquireReadLockOnCacheKeyNoWait(java.util.Vector primaryKey)
Acquire a read lock on the object, if not already locked. |
abstract java.lang.Object |
clone()
Clone the map and all of the CacheKeys. |
void |
collectLocks(java.util.HashMap threadList)
Add all locked CacheKeys to the map grouped by thread. |
boolean |
containsKey(java.util.Vector primaryKey)
Return true if an CacheKey with the primary key is in the map. |
protected abstract CacheKeyInterceptor |
createCacheKeyInterceptor(org.eclipse.persistence.internal.identitymaps.CacheKey wrappedCacheKey)
|
java.util.Enumeration |
elements()
Allow for the cache to be iterated on. |
java.lang.Object |
get(java.util.Vector primaryKey)
Return the object cached in the identity map or null if it could not be found. |
org.eclipse.persistence.internal.identitymaps.CacheKey |
getCacheKey(java.util.Vector primaryKey)
Get the cache key (with object) for the primary key. |
org.eclipse.persistence.internal.identitymaps.CacheKey |
getCacheKeyForLock(java.util.Vector primaryKey)
Get the cache key (with object) for the primary key. |
ClassDescriptor |
getDescriptor()
Return the descriptor that this is the map for. |
java.lang.Class |
getDescriptorClass()
Return the class that this is the map for. |
int |
getMaxSize()
|
int |
getSize()
Return the number of CacheKeys in the IdentityMap. |
int |
getSize(java.lang.Class myClass,
boolean recurse)
Return the number of actual objects of type myClass in the IdentityMap. |
org.eclipse.persistence.internal.identitymaps.IdentityMap |
getTargetIdenttyMap()
Return the instance of the IdentityMap that this intercpetor is wrapping. |
java.lang.Object |
getWrapper(java.util.Vector primaryKey)
Get the wrapper object from the cache key associated with the given primary key, this is used for EJB2. |
java.lang.Object |
getWriteLockValue(java.util.Vector primaryKey)
Get the write lock value from the cache key associated to the primarykey. |
java.util.Enumeration |
keys()
Allow for the CacheKeys to be iterated on. |
java.util.Enumeration |
keys(boolean checkReadLocks)
Allow for the CacheKeys to be iterated on. - value should be true if readloacks are to be used, false otherwise. |
org.eclipse.persistence.internal.identitymaps.CacheKey |
put(java.util.Vector primaryKey,
java.lang.Object object,
java.lang.Object writeLockValue,
long readTime)
Store the object in the cache at its primary key. |
java.lang.Object |
remove(org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey)
Remove the CacheKey from the map. |
java.lang.Object |
remove(java.util.Vector primaryKey,
java.lang.Object object)
Remove the CacheKey with the primaryKey from the map. |
void |
setDescriptor(ClassDescriptor descriptor)
Set the descriptor that this is the map for. |
void |
setWrapper(java.util.Vector primaryKey,
java.lang.Object wrapper)
Update the wrapper object in the CacheKey associated with the given primaryKey, this is used for EJB2. |
void |
setWriteLockValue(java.util.Vector primaryKey,
java.lang.Object writeLockValue)
Update the write lock value of the CacheKey associated with the given primaryKey. |
java.lang.String |
toString()
|
void |
updateMaxSize(int maxSize)
This method will be used to update the max cache size, any objects exceeding the max cache size will be remove from the cache. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.persistence.internal.identitymaps.IdentityMap |
---|
release |
Field Detail |
---|
protected org.eclipse.persistence.internal.identitymaps.IdentityMap targetIdentityMap
protected org.eclipse.persistence.internal.sessions.AbstractSession interceptedSession
Constructor Detail |
---|
public CacheInterceptor(org.eclipse.persistence.internal.identitymaps.IdentityMap targetIdentityMap, org.eclipse.persistence.internal.sessions.AbstractSession interceptedSession)
Method Detail |
---|
public org.eclipse.persistence.internal.identitymaps.CacheKey acquireDeferredLock(java.util.Vector primaryKey)
acquireDeferredLock
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public org.eclipse.persistence.internal.identitymaps.CacheKey acquireLock(java.util.Vector primaryKey, boolean forMerge)
acquireLock
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public org.eclipse.persistence.internal.identitymaps.CacheKey acquireLockNoWait(java.util.Vector primaryKey, boolean forMerge)
acquireLockNoWait
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public org.eclipse.persistence.internal.identitymaps.CacheKey acquireLockWithWait(java.util.Vector primaryKey, boolean forMerge, int wait)
acquireLockWithWait
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public org.eclipse.persistence.internal.identitymaps.CacheKey acquireReadLockOnCacheKey(java.util.Vector primaryKey)
acquireReadLockOnCacheKey
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public org.eclipse.persistence.internal.identitymaps.CacheKey acquireReadLockOnCacheKeyNoWait(java.util.Vector primaryKey)
acquireReadLockOnCacheKeyNoWait
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public void collectLocks(java.util.HashMap threadList)
collectLocks
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public abstract java.lang.Object clone()
clone
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
clone
in class java.lang.Object
public boolean containsKey(java.util.Vector primaryKey)
containsKey
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
primaryKey
- is the primary key for the object to search for.protected abstract CacheKeyInterceptor createCacheKeyInterceptor(org.eclipse.persistence.internal.identitymaps.CacheKey wrappedCacheKey)
public java.util.Enumeration elements()
elements
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public java.lang.Object get(java.util.Vector primaryKey)
get
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public org.eclipse.persistence.internal.identitymaps.CacheKey getCacheKey(java.util.Vector primaryKey)
getCacheKey
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public org.eclipse.persistence.internal.identitymaps.CacheKey getCacheKeyForLock(java.util.Vector primaryKey)
getCacheKeyForLock
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public ClassDescriptor getDescriptor()
getDescriptor
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public java.lang.Class getDescriptorClass()
getDescriptorClass
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public int getMaxSize()
getMaxSize
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public int getSize()
getSize
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public int getSize(java.lang.Class myClass, boolean recurse)
getSize
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public org.eclipse.persistence.internal.identitymaps.IdentityMap getTargetIdenttyMap()
public java.lang.Object getWrapper(java.util.Vector primaryKey)
getWrapper
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public java.lang.Object getWriteLockValue(java.util.Vector primaryKey)
getWriteLockValue
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public java.util.Enumeration keys()
keys
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public java.util.Enumeration keys(boolean checkReadLocks)
keys
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public org.eclipse.persistence.internal.identitymaps.CacheKey put(java.util.Vector primaryKey, java.lang.Object object, java.lang.Object writeLockValue, long readTime)
put
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
primaryKey
- is the primary key for the object.object
- is the domain object to cache.writeLockValue
- is the current write lock value of object, if null the version is ignored.public java.lang.Object remove(java.util.Vector primaryKey, java.lang.Object object)
remove
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public java.lang.Object remove(org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey)
remove
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public void updateMaxSize(int maxSize)
updateMaxSize
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public void setDescriptor(ClassDescriptor descriptor)
setDescriptor
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public void setWrapper(java.util.Vector primaryKey, java.lang.Object wrapper)
setWrapper
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public void setWriteLockValue(java.util.Vector primaryKey, java.lang.Object writeLockValue)
setWriteLockValue
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
public java.lang.String toString()
toString
in interface org.eclipse.persistence.internal.identitymaps.IdentityMap
toString
in class java.lang.Object
|
EclipseLink 1.2.0, build 'v20091016-r5565' API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |