Package org.datanucleus
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 Set
Reachability : Set of ids of objects deleted using deleteObject.private ExecutionContext
private Set
Reachability : Set of ids for all objects enlisted in this transaction.private boolean
Flag for whether we are running "persistence-by-reachability" at commit execute() at this point in time.private Set
Reachability : Set of ids of objects newly persistent in the current transactionprivate Set
Reachability : 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 TypeMethodDescriptionvoid
void
void
void
void
clear()
Method to clear the stored ids of objects involved in the reachability process.void
execute()
Method to perform the "persistence-by-reachability" at commit.boolean
boolean
boolean
boolean
boolean
void
swapObjectId
(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
Method that will allow swapping of an "id", for example when an object has recently been assigned its true "id".- Parameters:
oldID
- The old id that it is registered with. If this is null then we do nothingnewID
- The new id to use in place
-
execute
public void execute()Method to perform the "persistence-by-reachability" at commit.
-