Interface PersistenceManager
-
- All Superinterfaces:
PersistenceManager
- All Known Implementing Classes:
PersistenceManagerImpl
public interface PersistenceManager extends PersistenceManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
acquireCacheLock()
Lock cache for getObjectById and result processing synchronization.void
acquireExclusiveLock()
Acquires an exclusive lock from the persistence manager.void
acquireFieldUpdateLock()
Serialize field updatesvoid
acquireShareLock()
Acquires a share lock from the persistence manager.void
afterCompletion(int status)
Called by Transaction commit() or rollback() cleans up transactional cachevoid
beforeCompletion()
Called by Transaction commit() Loops through transactional cache and calls PersistentStore.updatePersistent() on each instancevoid
clearFields(Object pc)
void
deregisterInstance(Object oid)
Deregister an instance.void
deregisterInstance(Object oid, StateManager sm)
Deregister an instance with this object Id, only if it holds the same instance.StateManager
findOrCreateStateManager(Object oid, Class pcClass)
Returns StateManager instance for this Object Id.void
forceClose()
Force to close the persistence manager.PersistenceManagerWrapper
getCurrentWrapper()
Object
getField(Object pc, int fieldNumber)
byte
getFlags(Object pc)
RetrieveDesc
getRetrieveDesc(Class classType)
Return a RetrieveDesc given a Class object.RetrieveDesc
getRetrieveDesc(String fieldName, Class classType)
Return a RetrieveDesc for a foreign field (relationship) given the Class object for the parent class.StateManager
getStateManager(Object pc)
boolean
initializeFromVersionConsistencyCache(StateManager sm)
Looks up the given instance in the Version Consistency cache and if found, populates it from the cached values.void
internalFlush()
Called by Query in pessimistic transaction to flush changes to the databaseboolean
isActiveTransaction()
Returns true if associated transaction is activeboolean
isNontransactionalRead()
Returns true if nontransactionalRead flag is set to true.boolean
isOptimisticTransaction()
Returns true if associated transaction is optimisticObject
newCollectionInstanceInternal(Class type, Object owner, String fieldName, Class elementType, boolean allowNulls, int initialSize)
Called by newCollectionInstance from the public interface or internally by the runtime Will not result in marking field as dirtyObject
newInstance(StateManager sm)
Object
newSCOInstanceInternal(Class type, Object owner, String fieldName)
Called by newSCOInstance from the public interface or internally by the runtime Will not result in marking field as dirty Returns a new Second Class Object instance of the type specified,void
notifyNontransactionalRead(boolean nontransactionalRead)
For Transaction to notify PersistenceManager that optimistic flag is changedvoid
notifyOptimistic(boolean optimistic)
For Transaction to notify PersistenceManager that optimistic flag is changedvoid
notifyStatusChange(boolean isActive)
For Transaction to notify PersistenceManager that status is changedvoid
registerInstance(StateManager sm, Object oid)
Called by StateManager to register persistent instance at the rollback if it was removed from the global (weak) cache as the result of the replace operation.void
registerInstance(StateManager sm, Object oid, boolean throwDuplicateException, boolean forceRegister)
Called by StateManager to register new instance.void
releaseCacheLock()
Release cache lock.void
releaseExclusiveLock()
Release the exclusive lock and notify any thread waiting to get an exclusive or share lock.void
releaseFieldUpdateLock()
Allow other threads to update fieldsvoid
releaseShareLock()
Releases the share lock and notify any thread waiting to get an exclusive lock.Object
retrieve(RetrieveDesc action)
Executes the given retrieve descriptor.Object
retrieve(RetrieveDesc action, ValueFetcher parameters)
Executes the given retrieve descriptor.void
setField(Object pc, int fieldNumber, Object value)
void
setFlags(Object pc, byte flags)
void
setStateManager(Object pc, StateManager sm)
-
Methods inherited from interface com.sun.jdo.api.persistence.support.PersistenceManager
close, currentTransaction, deletePersistent, deletePersistent, deletePersistent, getExtent, getObjectById, getObjectById, getObjectId, getObjectIdClass, getPersistenceManagerFactory, getProperties, getRequireCopyObjectId, getRequireTrackedSCO, getSupersedeDeletedInstance, getTransactionalInstance, getUserObject, isClosed, makePersistent, makePersistent, makePersistent, newCollectionInstance, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newSCOInstance, setRequireCopyObjectId, setRequireTrackedSCO, setSupersedeDeletedInstance, setUserObject
-
-
-
-
Method Detail
-
getCurrentWrapper
PersistenceManagerWrapper getCurrentWrapper()
-
newInstance
Object newInstance(StateManager sm)
-
setStateManager
void setStateManager(Object pc, StateManager sm)
-
setFlags
void setFlags(Object pc, byte flags)
-
getFlags
byte getFlags(Object pc)
-
getStateManager
StateManager getStateManager(Object pc)
-
clearFields
void clearFields(Object pc)
-
retrieve
Object retrieve(RetrieveDesc action, ValueFetcher parameters)
Executes the given retrieve descriptor. The result is a collection unless an aggregate query was specified. In most cases the query result is a collection of persistent objects. In case of a projection on a local field the collection holds objects of that type. For aggregate queries the result is a single object, which type was defined by the caller.- Parameters:
action
- The retrieve descriptor.parameters
- The input parameters for the query.- Returns:
- A collection of (persistent) objects unless an aggregate query was specified.
-
retrieve
Object retrieve(RetrieveDesc action)
Executes the given retrieve descriptor. The result is a collection unless an aggregate query was specified. In most cases the query result is a collection of persistent objects. In case of a projection on a local field the collection holds objects of that type. For aggregate queries the result is a single object, which type was defined by the caller.- Parameters:
action
- The retrieve descriptor.- Returns:
- A collection of (persistent) objects unless an aggregate query was specified.
-
getRetrieveDesc
RetrieveDesc getRetrieveDesc(Class classType)
Return a RetrieveDesc given a Class object.
-
getRetrieveDesc
RetrieveDesc getRetrieveDesc(String fieldName, Class classType)
Return a RetrieveDesc for a foreign field (relationship) given the Class object for the parent class.
-
afterCompletion
void afterCompletion(int status)
Called by Transaction commit() or rollback() cleans up transactional cache- Parameters:
status
- jakarta.transaction.Status
-
beforeCompletion
void beforeCompletion()
Called by Transaction commit() Loops through transactional cache and calls PersistentStore.updatePersistent() on each instance
-
internalFlush
void internalFlush()
Called by Query in pessimistic transaction to flush changes to the database
-
registerInstance
void registerInstance(StateManager sm, Object oid, boolean throwDuplicateException, boolean forceRegister)
Called by StateManager to register new instance. This method will throw an JDOUserException if throwDuplicateException is true and the object being registered already exists in the pm cache.
-
registerInstance
void registerInstance(StateManager sm, Object oid)
Called by StateManager to register persistent instance at the rollback if it was removed from the global (weak) cache as the result of the replace operation.
-
deregisterInstance
void deregisterInstance(Object oid)
Deregister an instance.
-
deregisterInstance
void deregisterInstance(Object oid, StateManager sm)
Deregister an instance with this object Id, only if it holds the same instance.
-
notifyStatusChange
void notifyStatusChange(boolean isActive)
For Transaction to notify PersistenceManager that status is changed
-
notifyOptimistic
void notifyOptimistic(boolean optimistic)
For Transaction to notify PersistenceManager that optimistic flag is changed
-
isOptimisticTransaction
boolean isOptimisticTransaction()
Returns true if associated transaction is optimistic
-
notifyNontransactionalRead
void notifyNontransactionalRead(boolean nontransactionalRead)
For Transaction to notify PersistenceManager that optimistic flag is changed
-
isNontransactionalRead
boolean isNontransactionalRead()
Returns true if nontransactionalRead flag is set to true.
-
isActiveTransaction
boolean isActiveTransaction()
Returns true if associated transaction is active
-
newSCOInstanceInternal
Object newSCOInstanceInternal(Class type, Object owner, String fieldName)
Called by newSCOInstance from the public interface or internally by the runtime Will not result in marking field as dirty Returns a new Second Class Object instance of the type specified,- Parameters:
type
- Class of the new SCO instanceowner
- the owner to notify upon changesfieldName
- the field to notify upon changes- Returns:
- the object of the class type
-
newCollectionInstanceInternal
Object newCollectionInstanceInternal(Class type, Object owner, String fieldName, Class elementType, boolean allowNulls, int initialSize)
Called by newCollectionInstance from the public interface or internally by the runtime Will not result in marking field as dirty- Parameters:
type
- Class of the new SCO instanceowner
- the owner to notify upon changesfieldName
- the field to notify upon changeselementType
- the element types allowedallowNulls
- true if allowedinitialSize
- initial size of the Collection- Returns:
- the object of the class type
-
acquireFieldUpdateLock
void acquireFieldUpdateLock()
Serialize field updates
-
releaseFieldUpdateLock
void releaseFieldUpdateLock()
Allow other threads to update fields
-
acquireShareLock
void acquireShareLock()
Acquires a share lock from the persistence manager. This method will put the calling thread to sleep if another thread is holding the exclusive lock.
-
releaseShareLock
void releaseShareLock()
Releases the share lock and notify any thread waiting to get an exclusive lock. Note that every releaseShareLock() call needs to be preceeded by an acquireShareLock() call.
-
acquireExclusiveLock
void acquireExclusiveLock()
Acquires an exclusive lock from the persistence manager. By acquiring an exclusive lock, a thread is guaranteed to have exclusive right to the persistence runtime meaning no other threads can perform any operation in the runtime.
-
releaseExclusiveLock
void releaseExclusiveLock()
Release the exclusive lock and notify any thread waiting to get an exclusive or share lock. Note that every releaseShareLock() call needs to be preceeded by an acquireExclusiveLock() call.
-
forceClose
void forceClose()
Force to close the persistence manager. Called by TransactionImpl.afterCompletion in case of the CMT transaction and the status value passed to the method cannot be resolved.
-
findOrCreateStateManager
StateManager findOrCreateStateManager(Object oid, Class pcClass)
Returns StateManager instance for this Object Id.- Parameters:
oid
- the ObjectId to look up.pcClass
- the expected Class type of the new PC instance.
-
acquireCacheLock
void acquireCacheLock()
Lock cache for getObjectById and result processing synchronization.
-
releaseCacheLock
void releaseCacheLock()
Release cache lock.
-
initializeFromVersionConsistencyCache
boolean initializeFromVersionConsistencyCache(StateManager sm)
Looks up the given instance in the Version Consistency cache and if found, populates it from the cached values.- Parameters:
sm
- Instance to be looked up in the version consistency cache. If found, it is populated with values from the cache.- Returns:
- true if the
sm
was found and populated, false otherwise.
-
-