Class ReachabilityAtCommitHandler
java.lang.Object
org.datanucleus.ReachabilityAtCommitHandler
Handler to process "persistence-by-reachability" at commit.
This is a feature of the JDO spec that is enabled by default for that API.
It runs a cursory check for objects that have been pulled in to be persisted by "persistence-by-reachability" (cascading) but that are no longer needing to be persisted
maybe due to the cascading origin object being deleted.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SetReachability : Set of ids of objects deleted using deleteObject.private ExecutionContextprivate SetReachability : Set of ids for all objects enlisted in this transaction.private booleanFlag for whether we are running "persistence-by-reachability" at commit execute() at this point in time.private SetReachability : Set of ids of objects newly persistent in the current transactionprivate SetReachability : Set of ids of objects persisted using persistObject, or known as already persistent in the current txn. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for a reachability-at-commit handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidvoidvoidclear()Method to clear the stored ids of objects involved in the reachability process.voidexecute()Method to perform the "persistence-by-reachability" at commit.booleanbooleanbooleanbooleanbooleanvoidswapObjectId(Object oldID, Object newID) Method that will allow swapping of an "id", for example when an object has recently been assigned its true "id".
-
Field Details
-
ec
-
executing
private boolean executingFlag for whether we are running "persistence-by-reachability" at commit execute() at this point in time. -
persistedIds
Reachability : Set of ids of objects persisted using persistObject, or known as already persistent in the current txn. -
deletedIds
Reachability : Set of ids of objects deleted using deleteObject. -
flushedNewIds
Reachability : Set of ids of objects newly persistent in the current transaction -
enlistedIds
Reachability : Set of ids for all objects enlisted in this transaction.
-
-
Constructor Details
-
ReachabilityAtCommitHandler
Constructor for a reachability-at-commit handler.- Parameters:
ec- ExecutionContext that it is for
-
-
Method Details
-
clear
public void clear()Method to clear the stored ids of objects involved in the reachability process. -
isExecuting
public boolean isExecuting() -
addEnlistedObject
-
isObjectEnlisted
-
addPersistedObject
-
isObjectPersisted
-
addDeletedObject
-
isObjectDeleted
-
addFlushedNewObject
-
isObjectFlushedNew
-
swapObjectId
-
execute
public void execute()Method to perform the "persistence-by-reachability" at commit.
-