public class MergeManager
extends java.lang.Object
Purpose: Used to manage the merge of two objects in a unit of work.
Modifier and Type | Field and Description |
---|---|
static int |
CASCADE_ALL_PARTS |
static int |
CASCADE_BY_MAPPING |
static int |
CASCADE_PRIVATE_PARTS |
static boolean |
LOCK_ON_MERGE
Backdoor to disable merge locks.
|
static int |
NO_CASCADE |
Constructor and Description |
---|
MergeManager(AbstractSession session) |
Modifier and Type | Method and Description |
---|---|
void |
cascadeAllParts()
Cascade all parts, this is the default for the merge.
|
void |
cascadePrivateParts()
Cascade private parts, this can be used to merge clone when using RMI.
|
void |
checkNewObjectLockVersion(java.lang.Object clone,
java.lang.Object primaryKey,
ClassDescriptor descriptor,
UnitOfWorkImpl unitOfWork)
Check if the new object's version has been set, if so, then it was an existing object that was deleted.
|
void |
dontCascadeParts()
Merge only direct parts, this can be used to merge clone when using RMI.
|
java.util.ArrayList<CacheKey> |
getAcquiredLocks() |
int |
getCascadePolicy() |
java.lang.Thread |
getLockThread()
INTERNAL:
|
java.util.IdentityHashMap |
getMergedNewObjects()
INTERNAL:
Used to return a map containing new objects found through the
registerObjectForMergeCloneIntoWorkingCopy method.
|
java.lang.Object |
getMergedObject(java.lang.Object key,
AbstractSession targetSession) |
java.util.Map |
getObjectDescriptors() |
java.util.Map |
getObjectsAlreadyMerged() |
java.lang.Object |
getObjectToMerge(java.lang.Object sourceValue,
ClassDescriptor descriptor,
AbstractSession targetSession) |
LinkedNode |
getQueueNode()
INTENRAL:
Used to get the node that this merge manager is stored in, within the WriteLocksManager write lockers queue
|
AbstractSession |
getSession() |
long |
getSystemTime()
Get the stored value of the current time.
|
java.lang.Object |
getTargetVersionOfSourceObject(java.lang.Object source,
ClassDescriptor descriptor,
AbstractSession targetSession)
Return the corresponding value that should be assigned to the target object for the source object.
|
java.lang.Object |
getWriteLockQueued()
INTENRAL:
Used to get the object that the merge manager is waiting on, in order to acquire locks
|
boolean |
isAlreadyMerged(java.lang.Object object,
AbstractSession targetSession) |
boolean |
isForRefresh() |
boolean |
isTransitionedToDeferredLocks()
INTERNAL:
Will return if the merge process has transitioned the active merge locks to deferred locks for
readlock deadlock avoidance.
|
java.lang.Object |
mergeChanges(java.lang.Object object,
ObjectChangeSet objectChangeSet,
AbstractSession targetSession)
Recursively merge changes in the object dependent on the merge policy.
|
void |
mergeChangesFromChangeSet(UnitOfWorkChangeSet uowChangeSet)
INTERNAL:
Merge the changes to all objects to session's cache.
|
java.lang.Object |
mergeChangesOfWorkingCopyIntoRemote(java.lang.Object clone)
Recursively merge changes in the object dependent on the merge policy.
|
void |
mergeCloneIntoWorkingCopy()
This can be used by the user for merging clones from RMI into the unit of work.
|
void |
mergeCloneWithReferencesIntoWorkingCopy()
This is used during the merge of dependent objects referencing independent objects, where you want
the independent objects merged as well.
|
void |
mergeIntoDistributedCache()
This is used during cache synchronization to merge the changes into the distributed cache.
|
java.lang.Object |
mergeNewObjectIntoCache(ObjectChangeSet changeSet)
Merge a change set for a new object into the cache.
|
void |
mergeOriginalIntoWorkingCopy()
This is used to revert changes to objects, or during refreshes.
|
void |
mergeWorkingCopyIntoOriginal()
This is used during the unit of work commit to merge changes into the parent.
|
void |
mergeWorkingCopyIntoRemote()
This is used during the unit of work commit to merge changes into the parent.
|
void |
recordMerge(java.lang.Object key,
java.lang.Object value,
AbstractSession targetSession) |
void |
refreshRemoteObject()
INTERNAL:
This is used to refresh remote session object
|
java.lang.Object |
registerExistingObjectOfReadOnlyClassInNestedTransaction(java.lang.Object source,
ClassDescriptor descriptor,
AbstractSession targetSession)
INTERNAL:
Used to register an existing object used in nested unit of work with
read-only class in root unit of work.
|
void |
registerRemovedNewObjectIfRequired(java.lang.Object removedObject)
Determine if the object is a registered new object, and that this is a nested unit of work
merge into the parent.
|
void |
setCascadePolicy(int cascadePolicy) |
void |
setForceCascade(boolean forceCascade) |
void |
setForRefresh(boolean isforRefresh) |
void |
setLockThread(java.lang.Thread lockThread)
INTERNAL:
Save the currentThread for later comparison to the activeThread in case they don't match
|
void |
setObjectDescriptors(java.util.Map objectDescriptors) |
void |
setQueueNode(LinkedNode node)
INTENRAL:
Used to set the node that this merge manager is stored in, within the WriteLocksManager write lockers queue
|
void |
setWriteLockQueued(java.lang.Object primaryKey)
INTENRAL:
Used to set the object that the merge manager is waiting on, in order to acquire locks
If this value is null then the merge manager is not waiting on any locks.
|
boolean |
shouldCascadeAllParts()
Flag used to determine if all parts should be cascaded
|
boolean |
shouldCascadeByMapping()
Flag used to determine that the mappings should be checked for
cascade requirements.
|
boolean |
shouldCascadeParts()
Flag used to determine if any parts should be cascaded
|
boolean |
shouldCascadePrivateParts()
Flag used to determine if any private parts should be cascaded
|
boolean |
shouldCascadeReferences()
Refreshes are based on the objects row, so all attributes of the object must be refreshed.
|
boolean |
shouldForceCascade()
This is used to cascade merge even if a clone is already registered.
|
boolean |
shouldMergeChangesIntoDistributedCache()
INTERNAL:
This happens when changes from an UnitOfWork is propagated to a distributed class.
|
boolean |
shouldMergeCloneIntoWorkingCopy()
This can be used by the user for merging clones from RMI into the unit of work.
|
boolean |
shouldMergeCloneWithReferencesIntoWorkingCopy()
This can be used by the user for merging remote EJB objects into the unit of work.
|
boolean |
shouldMergeOriginalIntoWorkingCopy()
This is used to revert changes to objects, or during refreshes.
|
boolean |
shouldMergeWorkingCopyIntoOriginal()
This is used during the unit of work commit to merge changes into the parent.
|
boolean |
shouldMergeWorkingCopyIntoRemote()
INTERNAL:
This happens when serialized remote unit of work has to be merged with local remote unit of work.
|
boolean |
shouldRefreshRemoteObject()
INTERNAL:
This is used to refresh objects on the remote session
|
void |
transitionToDeferredLocks()
INTERNAL:
Records that this merge manager has transitioned to use deferred locks during the merge.
|
public static final int NO_CASCADE
public static final int CASCADE_PRIVATE_PARTS
public static final int CASCADE_ALL_PARTS
public static final int CASCADE_BY_MAPPING
public static boolean LOCK_ON_MERGE
public MergeManager(AbstractSession session)
public void cascadeAllParts()
public void cascadePrivateParts()
public void dontCascadeParts()
public java.util.ArrayList<CacheKey> getAcquiredLocks()
public int getCascadePolicy()
public java.util.Map getObjectDescriptors()
public java.util.Map getObjectsAlreadyMerged()
public java.lang.Object getObjectToMerge(java.lang.Object sourceValue, ClassDescriptor descriptor, AbstractSession targetSession)
public LinkedNode getQueueNode()
public AbstractSession getSession()
public long getSystemTime()
public java.lang.Object getTargetVersionOfSourceObject(java.lang.Object source, ClassDescriptor descriptor, AbstractSession targetSession)
public java.lang.Object registerExistingObjectOfReadOnlyClassInNestedTransaction(java.lang.Object source, ClassDescriptor descriptor, AbstractSession targetSession)
public java.lang.Object getWriteLockQueued()
public boolean isForRefresh()
public void setForRefresh(boolean isforRefresh)
isforRefresh
- the isForMerge to setpublic boolean isTransitionedToDeferredLocks()
public java.lang.Object mergeChanges(java.lang.Object object, ObjectChangeSet objectChangeSet, AbstractSession targetSession) throws ValidationException
ValidationException
public void recordMerge(java.lang.Object key, java.lang.Object value, AbstractSession targetSession)
public boolean isAlreadyMerged(java.lang.Object object, AbstractSession targetSession)
public java.lang.Object getMergedObject(java.lang.Object key, AbstractSession targetSession)
public void mergeChangesFromChangeSet(UnitOfWorkChangeSet uowChangeSet)
public java.lang.Object mergeChangesOfWorkingCopyIntoRemote(java.lang.Object clone) throws ValidationException
ValidationException
public void mergeCloneIntoWorkingCopy()
public void mergeCloneWithReferencesIntoWorkingCopy()
public void mergeIntoDistributedCache()
public java.lang.Object mergeNewObjectIntoCache(ObjectChangeSet changeSet)
public void mergeOriginalIntoWorkingCopy()
public void mergeWorkingCopyIntoOriginal()
public void mergeWorkingCopyIntoRemote()
public void refreshRemoteObject()
public void checkNewObjectLockVersion(java.lang.Object clone, java.lang.Object primaryKey, ClassDescriptor descriptor, UnitOfWorkImpl unitOfWork)
public void registerRemovedNewObjectIfRequired(java.lang.Object removedObject)
public void setCascadePolicy(int cascadePolicy)
public void setForceCascade(boolean forceCascade)
public void setObjectDescriptors(java.util.Map objectDescriptors)
public void setQueueNode(LinkedNode node)
public void setWriteLockQueued(java.lang.Object primaryKey)
public boolean shouldCascadeByMapping()
public boolean shouldCascadeAllParts()
public boolean shouldCascadeParts()
public boolean shouldCascadePrivateParts()
public boolean shouldCascadeReferences()
public boolean shouldMergeChangesIntoDistributedCache()
public boolean shouldMergeCloneIntoWorkingCopy()
public boolean shouldMergeCloneWithReferencesIntoWorkingCopy()
public boolean shouldMergeOriginalIntoWorkingCopy()
public boolean shouldMergeWorkingCopyIntoOriginal()
public boolean shouldMergeWorkingCopyIntoRemote()
public boolean shouldRefreshRemoteObject()
public boolean shouldForceCascade()
public java.util.IdentityHashMap getMergedNewObjects()
public void transitionToDeferredLocks()
public java.lang.Thread getLockThread()
public void setLockThread(java.lang.Thread lockThread)
lockThread
- EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference