Methods Summary |
---|
public oracle.toplink.essentials.internal.identitymaps.CacheKey | acquireDeferredLock(java.util.Vector primaryKey, java.lang.Class javaClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)INTERNAL:
Deferred lock the identity map for the object, this is used for avoiding deadlock
The return cacheKey should be used to release the deferred lock
if (descriptor.isIsolated()) {
return getIdentityMapManager().acquireDeferredLock(primaryKey, javaClass, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().acquireDeferredLock(primaryKey, javaClass, descriptor);
}
|
public oracle.toplink.essentials.internal.identitymaps.CacheKey | acquireLock(java.util.Vector primaryKey, java.lang.Class domainClass, boolean forMerge, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)INTERNAL:
Provides access for setting a concurrency lock on an object in the IdentityMap.
called with true from the merge process, if true then the refresh will not refresh the object
if (descriptor.isIsolated()) {
return getIdentityMapManager().acquireLock(primaryKey, domainClass, forMerge, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().acquireLock(primaryKey, domainClass, forMerge, descriptor);
}
|
public oracle.toplink.essentials.internal.identitymaps.CacheKey | acquireLockNoWait(java.util.Vector primaryKey, java.lang.Class domainClass, boolean forMerge, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)INTERNAL:
Provides access for setting a concurrency lock on an object in the IdentityMap.
called with true from the merge process, if true then the refresh will not refresh the object
if (descriptor.isIsolated()) {
return getIdentityMapManager().acquireLockNoWait(primaryKey, domainClass, forMerge, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().acquireLockNoWait(primaryKey, domainClass, forMerge, descriptor);
}
|
public oracle.toplink.essentials.internal.identitymaps.CacheKey | acquireReadLockOnCacheKey(java.util.Vector primaryKey, java.lang.Class domainClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)INTERNAL:
Find the cachekey for the provided primary key and place a readlock on it.
This will allow multiple users to read the same object but prevent writes to
the object while the read lock is held.
if (descriptor.isIsolated()) {
return getIdentityMapManager().acquireReadLockOnCacheKey(primaryKey, domainClass, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().acquireReadLockOnCacheKey(primaryKey, domainClass, descriptor);
}
|
public oracle.toplink.essentials.internal.identitymaps.CacheKey | acquireReadLockOnCacheKeyNoWait(java.util.Vector primaryKey, java.lang.Class domainClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)INTERNAL:
Find the cachekey for the provided primary key and place a readlock on it.
This will allow multiple users to read the same object but prevent writes to
the object while the read lock is held.
If no readlock can be acquired then do not wait but return null.
if (descriptor.isIsolated()) {
return getIdentityMapManager().acquireReadLockOnCacheKeyNoWait(primaryKey, domainClass, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().acquireReadLockOnCacheKeyNoWait(primaryKey, domainClass, descriptor);
}
|
public boolean | acquireWriteLock()INTERNAL:
Lock the entire cache if the cache isolation requires.
By default concurrent reads and writes are allowed.
By write, unit of work merge is meant.
getIdentityMapManager().acquireWriteLock();
// must lock the parents cache as well.
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().acquireWriteLock();
|
public boolean | containsKey(java.util.Vector key, java.lang.Class theClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)INTERNAL:
Return whether the identity maps contain an item of the given class and key
if (descriptor.isIsolated()) {
return getIdentityMapManager().containsKey(key, theClass, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().containsKey(key, theClass, descriptor);
}
|
public boolean | containsObjectInIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)ADVANCED:
Return if their is an object for the primary key.
if (descriptor.isIsolated()) {
return getIdentityMapManager().containsKey(primaryKey, theClass, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().containsObjectInIdentityMap(primaryKey, theClass, descriptor);
}
|
public java.util.Vector | getAllFromIdentityMap(oracle.toplink.essentials.expressions.Expression selectionCriteria, java.lang.Class theClass, oracle.toplink.essentials.sessions.Record translationRow, oracle.toplink.essentials.queryframework.InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean shouldReturnInvalidatedObjects)ADVANCED:
Query the cache in-memory.
If the expression is too complex an exception will be thrown.
Only return objects that are invalid in the cache if specified.
if (session.getDescriptor(theClass).isIsolated()) {
return getIdentityMapManager().getAllFromIdentityMap(selectionCriteria, theClass, translationRow, valueHolderPolicy, shouldReturnInvalidatedObjects);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getAllFromIdentityMap(selectionCriteria, theClass, translationRow, valueHolderPolicy, shouldReturnInvalidatedObjects);
}
|
public oracle.toplink.essentials.internal.identitymaps.CacheKey | getCacheKeyForObject(java.util.Vector primaryKey, java.lang.Class myClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)INTERNAL:
Retrieve the cache key for the given identity information
if (descriptor.isIsolated()) {
return getIdentityMapManager().getCacheKeyForObject(primaryKey, myClass, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getCacheKeyForObject(primaryKey, myClass, descriptor);
}
|
public java.util.Vector | getClassesRegistered()INTERNAL:
This method is used to get a list of those classes with IdentityMaps in the Session.
Vector results = getIdentityMapManager().getClassesRegistered();
results.addAll(((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getClassesRegistered());
return results;
|
public java.lang.Object | getFromIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor, oracle.toplink.essentials.internal.queryframework.JoinedAttributeManager joinedAttributeManager)ADVANCED:
Return the object from the identity with the primary and class.
if (descriptor.isIsolated()) {
return getIdentityMapManager().getFromIdentityMap(primaryKey, theClass, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getFromIdentityMap(primaryKey, theClass, descriptor, joinedAttributeManager);
}
|
public java.lang.Object | getFromIdentityMap(oracle.toplink.essentials.expressions.Expression selectionCriteria, java.lang.Class theClass, oracle.toplink.essentials.sessions.Record translationRow, oracle.toplink.essentials.queryframework.InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean conforming, boolean shouldReturnInvalidatedObjects, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)INTERNAL:
Query the cache in-memory.
If the object is not found null is returned.
If the expression is too complex an exception will be thrown.
if (descriptor.isIsolated()) {
return getIdentityMapManager().getFromIdentityMap(selectionCriteria, theClass, translationRow, valueHolderPolicy, conforming, shouldReturnInvalidatedObjects, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getFromIdentityMap(selectionCriteria, theClass, translationRow, valueHolderPolicy, conforming, shouldReturnInvalidatedObjects, descriptor);
}
|
public java.lang.Object | getFromIdentityMapWithDeferredLock(java.util.Vector primaryKey, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)INTERNAL:
Return the object from the identity with the primary and class.
Only return invalidated objects if requested
if (descriptor.isIsolated()) {
return getIdentityMapManager().getFromIdentityMapWithDeferredLock(primaryKey, theClass, shouldReturnInvalidatedObjects, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getFromIdentityMapWithDeferredLock(primaryKey, theClass, shouldReturnInvalidatedObjects, descriptor);
}
|
public oracle.toplink.essentials.internal.identitymaps.IdentityMap | getIdentityMap(oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)INTERNAL:
Get the identity map for the given class from the IdentityMapManager
if (descriptor.isIsolated()) {
return getIdentityMapManager().getIdentityMap(descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getIdentityMap(descriptor);
}
|
public oracle.toplink.essentials.internal.identitymaps.IdentityMapManager | getIdentityMapManager()INTERNAL:
Get the IdentityMapManager for this IdentityMapAccessor
This method should be used for all IdentityMapManager access since it may
be overridden in sub classes.
return identityMapManager;
|
public long | getRemainingValidTime(java.lang.Object object)ADVANCED:
Return the remaining life of this object. This method is associated with use of
TopLink's cache invalidation feature and returns the difference between the next expiry
time of the object and its read time. The method will return 0 for invalidated objects.
ClassDescriptor descriptor = getSession().getDescriptor(object);
CacheKey key = this.getCacheKeyForObject(object, descriptor);
if (key == null) {
throw QueryException.objectDoesNotExistInCache(object);
}
return descriptor.getCacheInvalidationPolicy().getRemainingValidTime(key);
|
public oracle.toplink.essentials.internal.sessions.AbstractSession | getSession()INTERNAL:
get the session associated with this IdentityMapAccessor
return session;
|
public java.lang.Object | getWrapper(java.util.Vector primaryKey, java.lang.Class theClass)INTERNAL:
Get the wrapper object from the cache key associated with the given primary key,
this is used for EJB.
if (session.getDescriptor(theClass).isIsolated()) {
return getIdentityMapManager().getWrapper(primaryKey, theClass);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getWrapper(primaryKey, theClass);
}
|
public oracle.toplink.essentials.internal.helper.WriteLockManager | getWriteLockManager()INTERNAL:
Returns the single write Lock manager for this session
// As there should only be one write lock manager per server session
// get the one from the parent.
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getWriteLockManager();
|
public java.lang.Object | getWriteLockValue(java.util.Vector primaryKey, java.lang.Class theClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)ADVANCED:
Extract the write lock value from the identity map.
if (descriptor.isIsolated()) {
return getIdentityMapManager().getWriteLockValue(primaryKey, theClass, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().getWriteLockValue(primaryKey, theClass, descriptor);
}
|
public void | initializeAllIdentityMaps()PUBLIC:
Reset the entire object cache.
NOTE: be careful using this method. This method blows away both this session's and its parents caches,
this includes the server cache or any other cache. This throws away any objects that have been read in.
Extream caution should be used before doing this because object identity will no longer
be maintained for any objects currently read in. This should only be called
if the application knows that it no longer has references to object held in the cache.
getSession().log(SessionLog.FINER, SessionLog.CACHE, "initialize_all_local_identitymaps");
getIdentityMapManager().initializeIdentityMaps();
((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().initializeIdentityMaps();
|
public void | initializeIdentityMap(java.lang.Class theClass)PUBLIC:
Reset the identity map for only the instances of the class.
For inheritance the user must make sure that they only use the root class.
Caution must be used in doing this to ensure that the objects within the identity map
are not referenced from other objects of other classes or from the application.
getSession().log(SessionLog.FINER, SessionLog.CACHE, "initialize_identitymap", theClass);
if (session.getDescriptor(theClass).isIsolated()) {
getIdentityMapManager().initializeIdentityMap(theClass);
} else {
((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().initializeIdentityMap(theClass);
}
|
public void | initializeIdentityMaps()PUBLIC:
Reset the entire local object cache.
This throws away any objects that have been read in.
Extream caution should be used before doing this because object identity will no longer
be maintained for any objects currently read in. This should only be called
if the application knows that it no longer has references to object held in the cache.
getSession().log(SessionLog.FINER, SessionLog.CACHE, "initialize_identitymaps");
getIdentityMapManager().initializeIdentityMaps();
getSession().getCommitManager().reinitialize();
|
public oracle.toplink.essentials.internal.identitymaps.CacheKey | internalPutInIdentityMap(java.lang.Object domainObject, java.util.Vector key, java.lang.Object writeLockValue, long readTime, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)ADVANCED:
Register the object with the identity map.
The object must always be registered with its version number if optimistic locking is used.
The readTime may also be included in the cache key as it is constructed.
//no need to unwrap as the put will unwrap later anyway
if (descriptor.isIsolated()) {
return getIdentityMapManager().putInIdentityMap(domainObject, key, writeLockValue, readTime, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().internalPutInIdentityMap(domainObject, key, writeLockValue, readTime, descriptor);
}
|
public void | printIdentityMap(java.lang.Class businessClass)PUBLIC:
Used to print all the objects in the identity map of the passed in class.
The output of this method will be logged to this session's SessionLog at SEVERE level.
if (getSession().shouldLog(SessionLog.SEVERE, SessionLog.CACHE)) {
if (session.getDescriptor(businessClass).isIsolated()) {
getIdentityMapManager().printIdentityMap(businessClass);
} else {
((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().printIdentityMap(businessClass);
}
}
|
public void | printIdentityMapLocks()PUBLIC:
Used to print all the locks in every identity map in this session.
The output of this method will be logged to this session's SessionLog at FINEST level.
if (getSession().shouldLog(SessionLog.FINEST, SessionLog.CACHE)) {
getIdentityMapManager().printLocks();
((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().printIdentityMapLocks();
}
|
public void | printIdentityMaps()PUBLIC:
Used to print all the objects in every identity map in this session.
The output of this method will be logged to this session's SessionLog at SEVERE level.
if (getSession().shouldLog(SessionLog.SEVERE, SessionLog.CACHE)) {
getIdentityMapManager().printIdentityMaps();
((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().printIdentityMaps();
}
|
public void | releaseWriteLock()INTERNAL:
Lock the entire cache if the cache isolation requires.
By default concurrent reads and writes are allowed.
By write, unit of work merge is meant.
//release in the oposite order of the acquire
((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().releaseWriteLock();
getIdentityMapManager().releaseWriteLock();
|
public java.lang.Object | removeFromIdentityMap(java.util.Vector key, java.lang.Class theClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)ADVANCED:
Remove the object from the object cache.
if (descriptor.isIsolated()) {
return getIdentityMapManager().removeFromIdentityMap(key, theClass, descriptor);
} else {
return ((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().removeFromIdentityMap(key, theClass, descriptor);
}
|
public void | setIdentityMapManager(oracle.toplink.essentials.internal.identitymaps.IdentityMapManager identityMapManager)INTERNAL:
Set the IdentityMapManager for this IdentityMapAccessor
this.identityMapManager = identityMapManager;
|
public void | setWrapper(java.util.Vector primaryKey, java.lang.Class theClass, java.lang.Object wrapper)INTERNAL:
Update the wrapper object the cache key associated with the given primary key,
this is used for EJB.
if (getSession().getDescriptor(theClass).isIsolated()) {
getIdentityMapManager().setWrapper(primaryKey, theClass, wrapper);
} else {
((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().setWrapper(primaryKey, theClass, wrapper);
}
|
public void | updateWriteLockValue(java.util.Vector primaryKey, java.lang.Class theClass, java.lang.Object writeLockValue)ADVANCED:
Update the write lock value in the identity map.
if (getSession().getDescriptor(theClass).isIsolated()) {
getIdentityMapManager().setWriteLockValue(primaryKey, theClass, writeLockValue);
} else {
((IsolatedClientSession)session).getParent().getIdentityMapAccessorInstance().updateWriteLockValue(primaryKey, theClass, writeLockValue);
}
|