|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.ObjectManagerImpl
org.datanucleus.MultithreadedObjectManager
public class MultithreadedObjectManager
ObjectManager for handling the multithreaded PM/EM cases. Locks various methods in an attempt to prevent conflicting thread updates. Note we could have just put this code in ObjectManagerImpl. TODO Evaluate all of the places we currently lock (when multithreaded) to find corner cases not caught.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.datanucleus.store.ExecutionContext |
|---|
ExecutionContext.LifecycleListener |
| Field Summary |
|---|
| Fields inherited from class org.datanucleus.ObjectManagerImpl |
|---|
cache, LOCALISER, lock |
| Constructor Summary | |
|---|---|
MultithreadedObjectManager(NucleusContext ctx,
Object owner,
String userName,
String password)
|
|
| Method Summary | |
|---|---|
void |
addObjectProvider(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 Object Manager. |
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(Object obj,
FetchPlanState state)
Method to detach a persistent object without making a copy. |
Object |
detachObjectCopy(Object pc,
FetchPlanState state)
Detach a copy of the passed persistent object using the provided detach state. |
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. |
ObjectProvider |
findObjectProvider(Object pc)
Method to find the ObjectProvider for an object. |
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. |
boolean |
getMultithreaded()
Accessor for whether the object manager is multithreaded. |
void |
hereIsObjectProvider(ObjectProvider sm,
Object pc)
Method to add the ObjectProvider for an object to this ObjectManager's list. |
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. |
Query |
newQuery()
Construct an empty query instance. |
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 |
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 |
refreshObject(Object obj)
Method to do a refresh of an object, updating it from its datastore representation. |
void |
removeObjectProvider(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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultithreadedObjectManager(NucleusContext ctx,
Object owner,
String userName,
String password)
ctx - NucleusContextowner - Owner object (PM, EM)userName - Username for the datastorepassword - Password for the datastore| Method Detail |
|---|
public boolean getMultithreaded()
getMultithreaded in interface ExecutionContextgetMultithreaded in class ObjectManagerImplpublic void processNontransactionalUpdate()
ObjectManagerImpl
processNontransactionalUpdate in interface ExecutionContextprocessNontransactionalUpdate in class ObjectManagerImplpublic void enlistInTransaction(ObjectProvider sm)
ObjectManagerImpl
enlistInTransaction in interface ExecutionContextenlistInTransaction in class ObjectManagerImplsm - The ObjectProviderpublic void evictFromTransaction(ObjectProvider sm)
ObjectManagerImpl
evictFromTransaction in interface ExecutionContextevictFromTransaction in class ObjectManagerImplsm - The ObjectProviderpublic void addObjectProvider(ObjectProvider op)
ObjectManagerImpl
addObjectProvider in interface ExecutionContextaddObjectProvider in class ObjectManagerImplop - The ObjectProviderpublic void removeObjectProvider(ObjectProvider op)
ObjectManagerImpl
removeObjectProvider in interface ExecutionContextremoveObjectProvider in class ObjectManagerImplop - The ObjectProviderpublic ObjectProvider findObjectProvider(Object pc)
ObjectManagerImpl
findObjectProvider in interface ExecutionContextfindObjectProvider in class ObjectManagerImplpc - The object we are checking
public void hereIsObjectProvider(ObjectProvider sm,
Object pc)
ObjectManagerImpl
hereIsObjectProvider in interface ExecutionContexthereIsObjectProvider in class ObjectManagerImplsm - The ObjectProviderpc - The object managed by the ObjectProviderpublic void close()
ObjectManagerImpl
close in interface ExecutionContextclose in class ObjectManagerImplpublic void evictObject(Object obj)
ObjectManagerImpl
evictObject in interface ExecutionContextevictObject in class ObjectManagerImplobj - The objectpublic void refreshObject(Object obj)
ObjectManagerImpl
refreshObject in interface ExecutionContextrefreshObject in class ObjectManagerImplobj - The Object
public void retrieveObject(Object obj,
boolean fgOnly)
ObjectManagerImpl
retrieveObject in interface ExecutionContextretrieveObject in class ObjectManagerImplobj - The objectfgOnly - Whether to retrieve the current fetch group fields only
public Object persistObject(Object obj,
boolean merging)
ObjectManagerImpl
persistObject in interface ExecutionContextpersistObject in class ObjectManagerImplobj - The objectmerging - Whether this object (and dependents) is being merged
public Object[] persistObjects(Object[] objs)
ObjectManagerImpl
persistObjects in interface ExecutionContextpersistObjects in class ObjectManagerImplobjs - The objects to persist
public void deleteObject(Object obj)
ObjectManagerImpl
deleteObject in interface ExecutionContextdeleteObject in class ObjectManagerImplobj - The objectpublic void deleteObjects(Object[] objs)
ObjectManagerImpl
deleteObjects in interface ExecutionContextdeleteObjects in class ObjectManagerImplobjs - The objects
public void makeObjectTransient(Object obj,
FetchPlanState state)
ObjectManagerImpl
makeObjectTransient in interface ExecutionContextmakeObjectTransient in class ObjectManagerImplobj - The objectstate - Object containing the state of the fetch plan process (if any)public void makeObjectTransactional(Object obj)
ObjectManagerImpl
makeObjectTransactional in interface ExecutionContextmakeObjectTransactional in class ObjectManagerImplobj - The object
public void attachObject(ObjectProvider ownerOP,
Object pc,
boolean sco)
ObjectManagerImpl
attachObject in interface ExecutionContextattachObject in class ObjectManagerImplownerOP - 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)
ObjectManagerImpl
attachObjectCopy in interface ExecutionContextattachObjectCopy in class ObjectManagerImplownerOP - 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(Object obj,
FetchPlanState state)
ObjectManagerImpl
detachObject in interface ExecutionContextdetachObject in class ObjectManagerImplobj - The objectstate - State for the detachment process
public Object detachObjectCopy(Object pc,
FetchPlanState state)
ObjectManagerImpl
detachObjectCopy in interface ExecutionContextdetachObjectCopy in class ObjectManagerImplpc - The objectstate - State for the detachment process
public void clearDirty(ObjectProvider op)
ObjectManagerImpl
clearDirty in interface ExecutionContextclearDirty in class ObjectManagerImplop - The ObjectProviderpublic void clearDirty()
ObjectManagerImpl
clearDirty in interface ExecutionContextclearDirty in class ObjectManagerImplpublic void evictAllObjects()
evictAllObjects in interface ExecutionContextevictAllObjects in class ObjectManagerImpl
public void markDirty(ObjectProvider op,
boolean directUpdate)
ObjectManagerImpl
markDirty in interface ExecutionContextmarkDirty in class ObjectManagerImplop - ObjectProviderdirectUpdate - Whether the object has had a direct update made on it (if known)public void flush()
ObjectManagerImpl
flush in interface ExecutionContextflush in class ObjectManagerImplpublic void flushInternal(boolean flushToDatastore)
ObjectManagerImpl
flushInternal in interface ExecutionContextflushInternal in class ObjectManagerImplflushToDatastore - 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 datastore
public void replaceObjectId(Object pc,
Object oldID,
Object newID)
ObjectManagerImpl
replaceObjectId in interface ExecutionContextreplaceObjectId in class ObjectManagerImplpc - The Persistable objectoldID - the old id it was known bynewID - the new id
public Extent getExtent(Class pcClass,
boolean subclasses)
ObjectManagerImpl
getExtent in interface ExecutionContextgetExtent in class ObjectManagerImplpcClass - The class to querysubclasses - Whether to include subclasses in the query.
public Query newQuery()
ObjectManagerImpl
newQuery in interface ExecutionContextnewQuery in class ObjectManagerImpl
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||