|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jdo.impl.pm.CacheManagerImpl
Field Summary | |
private java.util.ArrayList |
_flushedCache
Collection of Persistent instances that will require state change at the transaction completion |
private java.util.ArrayList |
_newInstances
Collection of StateManager instances that represent Persistent instances that had been made newly persistent in the current transaction. |
private java.util.Collection |
_transientCache
Collection of Transient-transactional instances registered with this Transaction |
private java.util.Collection |
_txCache
Collection of Persistent instances created and/or updated in this Transaction |
private WeakValueHashMap |
_weakCache
Weak Hashtable of Persistent instances accessed by this PersistenceManager |
private static org.apache.commons.logging.Log |
logger
Logger instance |
private static I18NHelper |
msg
I18N message handler |
(package private) PersistenceManagerImpl |
pm
|
Constructor Summary | |
(package private) |
CacheManagerImpl(PersistenceManagerImpl pm)
Constructs new instnstance of CacheManagerImpl |
Method Summary | |
protected void |
afterCompletion(boolean abort)
Called by Transaction commit() or rollback() cleans up transactional cache |
protected void |
close()
close the CacheManagerImpl |
private StateManagerInternal |
createNewSM(java.lang.Object UserOid,
java.lang.Object internalOid,
java.lang.Class candidateClassType)
Creates new StateManager instance associated with this instance of ObjectId. |
private void |
debug(java.lang.String msg)
Tracing method |
private boolean |
debugging()
Verifies if debugging is enabled. |
protected void |
deregister(java.lang.Object oid)
Remove persistent instance from all caches |
protected void |
deregisterTransient(java.lang.Object sm)
Remove transient instance from the transient cache |
protected void |
evict(javax.jdo.spi.PersistenceCapable pc)
Make persistent instance hollow in this PersistenceManager. |
protected void |
evictAll()
Make all non-dirty persistent instances in the cache hollow in this PersistenceManager. |
protected void |
flushInstances()
Called by Transaction#commit(), Transaction#beforeCompletion(), or Transaction#internalFlush(). |
protected java.lang.Object |
getExternalObjectId(javax.jdo.spi.PersistenceCapable pc,
boolean transactional)
The ObjectId returned by this method represents the JDO identity of the instance. |
protected java.util.Collection |
getInsertedInstances()
Returns a Collection of instances that has been made persistent or become persistent through persistence-by-reachability algorithm in this transaction. |
protected java.lang.Object |
getObjectById(java.lang.Object oid,
boolean validate)
This method locates a persistent instance in the cache of instances managed by this PersistenceManager. |
private StateManagerInternal |
getStateManager(java.lang.Object oid,
boolean validate)
Returns StateManager instance associated with this instance of ObjectId |
protected StateManagerInternal |
getStateManager(java.lang.Object oid,
java.lang.Class pcClass)
Returns StateManager instance associated with this instance of ObjectId Creates a Hollow instance of a PersistenceCapable object, if it cannot be found in the cache |
protected void |
makeNontransactional(javax.jdo.spi.PersistenceCapable pc)
Make the transient or persistent instance transactional in this PersistenceManager. |
protected void |
makePersistent(javax.jdo.spi.PersistenceCapable pc)
Make the transient instance persistent in this PersistenceManager. |
protected void |
makeTransactional(javax.jdo.spi.PersistenceCapable pc)
Make the transient or persistent instance transactional in this PersistenceManager. |
protected void |
makeTransient(javax.jdo.spi.PersistenceCapable pc)
Make the persistent instance transient in this PersistenceManager. |
protected void |
markAsFlushed(StateManagerInternal sm)
|
protected void |
refresh(javax.jdo.spi.PersistenceCapable pc)
Refresh dirty persistent instance in this PersistenceManager. |
protected void |
refreshAllNontransactional()
Refresh nontransactional instances in the weak cache of this PersistenceManager. |
protected void |
refreshAllTransactional()
Refresh dirty persistent instances in the transactional cache of this PersistenceManager. |
protected void |
register(StateManagerInternal sm,
java.lang.Object oid,
boolean transactional,
boolean throwDuplicateException)
Register persistent instance in the transactional cache |
protected void |
registerTransient(StateManagerInternal sm)
Register transient instance in the transient cache |
protected void |
replaceObjectId(java.lang.Object oldId,
java.lang.Object newId)
|
protected void |
retrieve(javax.jdo.spi.PersistenceCapable pc)
Retrieve Hollow persistent instance in this PersistenceManager. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
PersistenceManagerImpl pm
private java.util.Collection _txCache
private java.util.Collection _transientCache
private java.util.ArrayList _flushedCache
private java.util.ArrayList _newInstances
private WeakValueHashMap _weakCache
private static final org.apache.commons.logging.Log logger
private static final I18NHelper msg
Constructor Detail |
CacheManagerImpl(PersistenceManagerImpl pm)
pm
- calling instance of PersistenceManagerImplMethod Detail |
protected void close()
protected java.lang.Object getObjectById(java.lang.Object oid, boolean validate)
If the validate flag is true: This method verifies that there is an instance in the data store with the same oid, constructs an instance, and returns it. If there is no transaction active, then a hollow instance or persistent non-transactional instance is returned. If there is a transaction active, then a persistent clean instance is returned.
If the validate flag is false: If there is not already an instance in the cache with the same oid, then an instance is constructed and returned. If the instance does not exist in the data store, then this method will not fail. However, a request to access fields of the instance will throw an exception.
oid
- an ObjectIdvalidate
- if the existence of the instance is to be validated
protected StateManagerInternal getStateManager(java.lang.Object oid, java.lang.Class pcClass)
oid
- an ObjectIdpcClass
- Class of a Hollow instance to be created.
protected java.lang.Object getExternalObjectId(javax.jdo.spi.PersistenceCapable pc, boolean transactional)
pc
- the PersistenceCapable instancetransactional
- true if transactional Id is requested
protected void makePersistent(javax.jdo.spi.PersistenceCapable pc)
pc
- a transient instance of a Class that implements
PersistenceCapableprotected void makeTransactional(javax.jdo.spi.PersistenceCapable pc)
PersistenceManager.makeTransactional(Object pc)
protected void makeNontransactional(javax.jdo.spi.PersistenceCapable pc)
PersistenceManager.makeNontransactional(Object pc)
protected void makeTransient(javax.jdo.spi.PersistenceCapable pc)
PersistenceManager.makeTransient(Object pc)
protected void evict(javax.jdo.spi.PersistenceCapable pc)
PersistenceManager.evict(Object pc)
protected void evictAll()
PersistenceManager.evictAll()
protected void retrieve(javax.jdo.spi.PersistenceCapable pc)
PersistenceManager.retrieve(Object pc)
protected void refresh(javax.jdo.spi.PersistenceCapable pc)
PersistenceManager.refresh(Object pc)
protected void refreshAllTransactional()
PersistenceManager.refreshAll()
protected void refreshAllNontransactional()
PersistenceManager.refreshAll()
protected void registerTransient(StateManagerInternal sm)
protected void register(StateManagerInternal sm, java.lang.Object oid, boolean transactional, boolean throwDuplicateException)
protected void deregisterTransient(java.lang.Object sm)
protected void deregister(java.lang.Object oid)
protected void replaceObjectId(java.lang.Object oldId, java.lang.Object newId)
PersistenceManagerInternal.replaceObjectId(Object oldId,
Object newId)
protected void markAsFlushed(StateManagerInternal sm)
PersistenceManagerInternal.markAsFlushed(StateManagerInternal sm)
protected void flushInstances()
protected void afterCompletion(boolean abort)
abort
- protected java.util.Collection getInsertedInstances()
PersistenceManagerInternal.getInsertedInstances()
private StateManagerInternal getStateManager(java.lang.Object oid, boolean validate)
oid
- an ObjectIdvalidate
- if the existence of the instance is to be validatedgetObjectById(Object oid, boolean validate)
private StateManagerInternal createNewSM(java.lang.Object UserOid, java.lang.Object internalOid, java.lang.Class candidateClassType)
UserOid
- a user provided ObjectIdinternalOid
- an internal ObjectIdcandidateClassType
- super class of a Hollow instance to be created.getObjectById(Object oid, boolean validate)
private void debug(java.lang.String msg)
msg
- String to displayprivate boolean debugging()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |