public class ExecutionContextThreadedImpl extends ExecutionContextImpl
This class *tries to be* thread-safe, but there is no guarantee. You are better advised to design your application to use ExecutionContextImpl for a single thread.
ExecutionContext.EmbeddedOwnerRelation, ExecutionContext.LifecycleListener| Modifier and Type | Field and Description |
|---|---|
protected Lock |
lock
Lock object for use during commit/rollback/evict, to prevent any further field accesses.
|
cache, opAssociatedValuesMapByOPOPTION_JTA_AUTOJOIN, OPTION_PASSWORD, OPTION_USERNAME| Constructor and Description |
|---|
ExecutionContextThreadedImpl(PersistenceNucleusContext ctx,
Object owner,
Map<String,Object> options) |
| Modifier and Type | Method and Description |
|---|---|
void |
addObjectProviderToCache(ObjectProvider op)
Method to add the object managed by the specified ObjectProvider to the (L1) cache.
|
void |
attachObject(ObjectProvider ownerOP,
Object pc,
boolean sco)
Method to attach a persistent detached object.
|
Object |
attachObjectCopy(ObjectProvider ownerOP,
Object pc,
boolean sco)
Method to attach a persistent detached object returning an attached copy of the object.
|
void |
clearDirty()
Method to clear all objects marked as dirty (whether directly or indirectly).
|
void |
clearDirty(ObjectProvider op)
Method to clear an object from the list of dirty objects.
|
void |
close()
Method to close the context.
|
void |
deleteObject(Object obj)
Method to delete an object from the datastore.
|
void |
deleteObjects(Object... objs)
Method to delete an array of objects from the datastore.
|
void |
detachObject(FetchPlanState state,
Object obj)
Method to detach a persistent object without making a copy.
|
Object |
detachObjectCopy(Object pc,
FetchPlanState state) |
void |
detachObjects(FetchPlanState state,
Object... objs)
Method to detach the passed object(s).
|
void |
enlistInTransaction(ObjectProvider sm)
Method to enlist the specified ObjectProvider in the current transaction.
|
void |
evictAllObjects()
Method to evict all current objects from L1 cache.
|
void |
evictFromTransaction(ObjectProvider sm)
Method to evict the specified ObjectProvider from the current transaction.
|
void |
evictObject(Object obj)
Internal method to evict an object from L1 cache.
|
void |
evictObjects(Class cls,
boolean subclasses)
Method to evict all objects of the specified type (and optionaly its subclasses) that are present in the L1 cache.
|
ObjectProvider |
findObjectProvider(Object pc)
Method to return the ObjectProvider for an object (if managed).
|
void |
flush()
Method callable from external APIs for user-management of flushing.
|
void |
flushInternal(boolean flushToDatastore)
This method flushes all dirty, new, and deleted instances to the datastore.
|
Extent |
getExtent(Class pcClass,
boolean subclasses)
Extents are collections of datastore objects managed by the datastore,
not by explicit user operations on collections.
|
Lock |
getLock()
Accessor for the context lock object.
|
boolean |
getMultithreaded()
Accessor for whether the usage is multi-threaded.
|
List<ObjectProvider> |
getObjectsToBeFlushed()
Convenience method to inspect the list of objects with outstanding changes to flush.
|
void |
makeObjectTransactional(Object obj)
Method to make an object transactional.
|
void |
makeObjectTransient(Object obj,
FetchPlanState state)
Method to migrate an object to transient state.
|
void |
markDirty(ObjectProvider op,
boolean directUpdate)
Method to mark an object (ObjectProvider) as dirty.
|
Object |
persistObject(Object obj,
boolean merging)
Method to make an object persistent.
|
Object[] |
persistObjects(Object... objs)
Method to persist an array of objects to the datastore.
|
void |
postBegin()
Method to perform any post-begin checks.
|
void |
postCommit()
Commit any changes made to objects managed by the object manager to the database.
|
void |
postRollback()
Callback invoked after the actual datastore rollback.
|
void |
preCommit()
Method to perform any pre-commit checks.
|
void |
preRollback()
Rollback any changes made to objects managed by the object manager to the database.
|
void |
processNontransactionalUpdate()
Method called when a non-tx update has been performed (via setter call on the persistable object, or via
use of mutator methods of a field).
|
void |
refreshAllObjects()
Method to do a refresh of all objects.
|
void |
refreshObject(Object obj)
Method to do a refresh of an object, updating it from its datastore representation.
|
void |
removeObjectProviderFromCache(ObjectProvider op)
Method to remove the object managed by the specified ObjectProvider from the cache.
|
void |
replaceObjectId(Object pc,
Object oldID,
Object newID)
Replace the previous object id for a persistable object with a new one.
|
void |
retrieveObject(Object obj,
boolean fgOnly)
Method to retrieve an object.
|
acquireThreadContextInfo, addInternalFetchGroup, addOperationToQueue, assertActiveTransaction, assertClassPersistable, assertDetachable, assertHasImplementationCreator, assertIsOpen, assertNotDetached, closeCallbackHandler, containsObjectProviderAssociatedValue, deleteObjectInternal, deregisterEmbeddedRelation, deregisterExecutionContextListener, detachAll, detachObjectCopy, exists, findObject, findObject, findObject, findObject, findObjectByUnique, findObjectProvider, findObjectProviderForEmbedded, findObjectProviderOfOwnerForAttachingObject, findObjects, findObjectsById, flushOperationsForBackingStore, getAttachDetachReferencedObject, getAttachedObjectForId, getBooleanProperty, getCallbackHandler, getClassLoaderResolver, getEmbeddedInformationForOwner, getFetchGroupManager, getFetchGroupsWithName, getFetchPlan, getFlushMode, getInternalFetchGroup, getIntProperty, getL2CacheableObject, getLevel1Cache, getLevel2CacheRetrieveMode, getLevel2CacheStoreMode, getLockManager, getManagedObjects, getManagedObjects, getManagedObjects, getManagedObjects, getManageRelations, getNucleusContext, getObjectFromCache, getObjectFromLevel1Cache, getObjectFromLevel2Cache, getObjectFromLevel2CacheForUnique, getObjectProviderAssociatedValue, getObjectsFromCache, getObjectsFromLevel2Cache, getOperationQueue, getOwner, getOwnerInformationForEmbedded, getOwnersForEmbeddedObjectProvider, getProperties, getProperty, getRelationshipManager, getSerializeReadForClass, getStatistics, getStringProperty, getSupportedProperties, getThreadContextInfo, getTransaction, hasIdentityInCache, hasPersistenceInformationForClass, initialise, initialiseLevel1Cache, isClosed, isDelayDatastoreOperationsEnabled, isEnlistedInTransaction, isFlushing, isInserting, isManagingRelations, isObjectModifiedInTransaction, isRunningDetachAllOnCommit, makeObjectNontransactional, markFieldsForUpdateInLevel2Cache, newInstance, newObjectId, newObjectId, operationQueueIsActive, persistObjectInternal, persistObjectInternal, processNontransactionalAtomicChanges, putObjectIntoLevel1Cache, putObjectIntoLevel2Cache, putObjectIntoLevel2CacheInternal, putObjectsIntoLevel2Cache, registerEmbeddedRelation, registerExecutionContextListener, releaseThreadContextInfo, removeEmbeddedOwnerRelation, removeInternalFetchGroup, removeObjectFromLevel1Cache, removeObjectFromLevel2Cache, removeObjectProviderAssociatedValue, setAttachDetachReferencedObject, setLevel2Cache, setObjectProviderAssociatedValue, setProperties, setProperty, transactionCommitted, transactionEnded, transactionFlushed, transactionPreCommit, transactionPreFlush, transactionPreRollBack, transactionReleaseSavepoint, transactionRollbackToSavepoint, transactionRolledBack, transactionSetSavepoint, transactionStartedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetApiAdapter, getMetaDataManager, getStoreManager, getTypeManager, persistObjectInternalprotected Lock lock
public ExecutionContextThreadedImpl(PersistenceNucleusContext ctx, Object owner, Map<String,Object> options)
ctx - NucleusContextowner - Owner object (PM, EM)options - Any options affecting startuppublic Lock getLock()
public boolean getMultithreaded()
getMultithreaded in interface ExecutionContextgetMultithreaded in class ExecutionContextImplpublic void processNontransactionalUpdate()
ExecutionContextImplprocessNontransactionalUpdate in interface ExecutionContextprocessNontransactionalUpdate in class ExecutionContextImplpublic void enlistInTransaction(ObjectProvider sm)
ExecutionContextImplenlistInTransaction in interface ExecutionContextenlistInTransaction in class ExecutionContextImplsm - The ObjectProviderpublic void evictFromTransaction(ObjectProvider sm)
ExecutionContextImplevictFromTransaction in interface ExecutionContextevictFromTransaction in class ExecutionContextImplsm - The ObjectProviderpublic void addObjectProviderToCache(ObjectProvider op)
ExecutionContextImpladdObjectProviderToCache in interface ExecutionContextaddObjectProviderToCache in class ExecutionContextImplop - The ObjectProviderpublic void removeObjectProviderFromCache(ObjectProvider op)
ExecutionContextImplremoveObjectProviderFromCache in interface ExecutionContextremoveObjectProviderFromCache in class ExecutionContextImplop - The ObjectProviderpublic ObjectProvider findObjectProvider(Object pc)
ExecutionContextImplfindObjectProvider in interface ExecutionContextfindObjectProvider in class ExecutionContextImplpc - The object we are checkingpublic void close()
ExecutionContextImplclose in interface ExecutionContextclose in class ExecutionContextImplpublic void evictObject(Object obj)
ExecutionContextImplevictObject in interface ExecutionContextevictObject in class ExecutionContextImplobj - The objectpublic void refreshObject(Object obj)
ExecutionContextImplrefreshObject in interface ExecutionContextrefreshObject in class ExecutionContextImplobj - The Objectpublic void retrieveObject(Object obj, boolean fgOnly)
ExecutionContextImplretrieveObject in interface ExecutionContextretrieveObject in class ExecutionContextImplobj - The objectfgOnly - Whether to retrieve the current fetch group fields onlypublic Object persistObject(Object obj, boolean merging)
ExecutionContextImplpersistObject in interface ExecutionContextpersistObject in class ExecutionContextImplobj - The objectmerging - Whether this object (and dependents) is being mergedpublic Object[] persistObjects(Object... objs)
ExecutionContextImplpersistObjects in interface ExecutionContextpersistObjects in class ExecutionContextImplobjs - The objects to persistpublic void deleteObject(Object obj)
ExecutionContextImpldeleteObject in interface ExecutionContextdeleteObject in class ExecutionContextImplobj - The objectpublic void deleteObjects(Object... objs)
ExecutionContextImpldeleteObjects in interface ExecutionContextdeleteObjects in class ExecutionContextImplobjs - The objectspublic void makeObjectTransient(Object obj, FetchPlanState state)
ExecutionContextImplmakeObjectTransient in interface ExecutionContextmakeObjectTransient in class ExecutionContextImplobj - The objectstate - Object containing the state of the fetch plan process (if any)public void makeObjectTransactional(Object obj)
ExecutionContextImplmakeObjectTransactional in interface ExecutionContextmakeObjectTransactional in class ExecutionContextImplobj - The objectpublic void attachObject(ObjectProvider ownerOP, Object pc, boolean sco)
ExecutionContextImplattachObject in interface ExecutionContextattachObject in class ExecutionContextImplownerOP - ObjectProvider of the owner object that has this in a field that causes this attachpc - The persistable objectsco - Whether the PC object is stored without an identity (embedded/serialised)public Object attachObjectCopy(ObjectProvider ownerOP, Object pc, boolean sco)
ExecutionContextImplattachObjectCopy in interface ExecutionContextattachObjectCopy in class ExecutionContextImplownerOP - ObjectProvider of the owner object that has this in a field that causes this attachpc - The objectsco - Whether it has no identity (second-class object)public void detachObject(FetchPlanState state, Object obj)
ExecutionContextImpldetachObject in interface ExecutionContextdetachObject in class ExecutionContextImplstate - State for the detachment processobj - The objectpublic void detachObjects(FetchPlanState state, Object... objs)
ExecutionContextdetachObjects in interface ExecutionContextdetachObjects in class ExecutionContextImplstate - State for the detachment process.objs - The object(s) to detachpublic Object detachObjectCopy(Object pc, FetchPlanState state)
public void clearDirty(ObjectProvider op)
ExecutionContextImplclearDirty in interface ExecutionContextclearDirty in class ExecutionContextImplop - The ObjectProviderpublic void clearDirty()
ExecutionContextImplclearDirty in interface ExecutionContextclearDirty in class ExecutionContextImplpublic void evictAllObjects()
evictAllObjects in interface ExecutionContextevictAllObjects in class ExecutionContextImplpublic void markDirty(ObjectProvider op, boolean directUpdate)
ExecutionContextImplmarkDirty in interface ExecutionContextmarkDirty in class ExecutionContextImplop - ObjectProviderdirectUpdate - Whether the object has had a direct update made on it (if known)public void flush()
ExecutionContextImplflush in interface ExecutionContextflush in class ExecutionContextImplpublic void flushInternal(boolean flushToDatastore)
ExecutionContextImplflushInternal in interface ExecutionContextflushInternal in class ExecutionContextImplflushToDatastore - Whether to ensure any changes reach the datastore
Otherwise they will be flushed to the datastore manager and leave it to
decide the opportune moment to actually flush them to the datastorepublic void replaceObjectId(Object pc, Object oldID, Object newID)
ExecutionContextImplreplaceObjectId in interface ExecutionContextreplaceObjectId in class ExecutionContextImplpc - The Persistable objectoldID - the old id it was known bynewID - the new idpublic Extent getExtent(Class pcClass, boolean subclasses)
ExecutionContextImplgetExtent in interface ExecutionContextgetExtent in class ExecutionContextImplpcClass - The class to querysubclasses - Whether to include subclasses in the query.public void evictObjects(Class cls, boolean subclasses)
ExecutionContextImplevictObjects in interface ExecutionContextevictObjects in class ExecutionContextImplcls - Type of persistable objectsubclasses - Whether to include subclassespublic void refreshAllObjects()
ExecutionContextImplrefreshAllObjects in interface ExecutionContextrefreshAllObjects in class ExecutionContextImplpublic List<ObjectProvider> getObjectsToBeFlushed()
ExecutionContextImplgetObjectsToBeFlushed in interface ExecutionContextgetObjectsToBeFlushed in class ExecutionContextImplpublic void postBegin()
ExecutionContextImplpostBegin in class ExecutionContextImplpublic void preCommit()
ExecutionContextImplpreCommit in class ExecutionContextImplpublic void postCommit()
ExecutionContextImplpostCommit in class ExecutionContextImplpublic void preRollback()
ExecutionContextImplpreRollback in class ExecutionContextImplpublic void postRollback()
ExecutionContextImplpostRollback in class ExecutionContextImplCopyright © 2019. All rights reserved.