Purpose: Used to manage the merge of two objects in a unit of work.
| Modifier and Type | Field and Description |
|---|---|
| protected ArrayList | acquiredLocks
Used to store the list of locks that this merge manager has acquired for this merge |
| public static final int | |
| public static final int | |
| public static final int | |
| protected int | cascadePolicy
Policy that determines how the merge will cascade to its object's parts. |
| protected static final int | |
| protected static final int | |
| protected static final int | |
| protected boolean | forceCascade
Force cascade merge even if a clone is already registered |
| protected boolean | isForRefresh
records that this merge process is for a refresh |
| protected boolean | isTransitionedToDeferredLocks
records that deferred locks have been employed for the merge process |
| public static boolean | LOCK_ON_MERGE
Backdoor to disable merge locks. |
| protected Thread | lockThread
save the currentThread for later comparison to the activeThread in case they don't match |
| protected IdentityHashMap | mergedNewObjects
Used to keep track of merged new objects. |
| protected int | mergePolicy
Policy that determines merge type (i.e. merge is used for several usages). |
| public static final int | |
| protected Map | objectDescriptors
Used only while refreshing objects on remote session |
| protected Map | objectsAlreadyMerged
Used to unravel recursion. |
| protected static final int | |
| protected LinkedNode | queueNode
Stores the node that holds this mergemanager within the WriteLocksManager queue |
| protected static final int | |
| protected AbstractSession | session
The unit of work merging for. |
| protected long | systemTime
Stored so that all objects merged by a merge manager can have the same readTime. |
| protected static final int | |
| protected static final int | |
| protected Object | writeLockQueued
If this variable is not null then the mergemanager is waiting on a particular primary key |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | checkNewObjectLockVersion(Object clone, 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. |
| public void | |
| public ArrayList | |
| public int | |
| public Thread | |
| public IdentityHashMap | Returns: MapINTERNAL: Used to return a map containing new objects found through the registerObjectForMergeCloneIntoWorkingCopy method. |
| public Object | |
| protected int | |
| public Map | |
| public Map | |
| public Object | |
| public LinkedNode | getQueueNode()
INTENRAL: Used to get the node that this merge manager is stored in, within the WriteLocksManager write lockers queue |
| public AbstractSession | |
| public long | |
| public Object | getTargetVersionOfSourceObject(Object source, ClassDescriptor descriptor, AbstractSession targetSession)
Return the corresponding value that should be assigned to the target object for the source object. |
| public Object | getWriteLockQueued()
INTENRAL: Used to get the object that the merge manager is waiting on, in order to acquire locks |
| public boolean | |
| public boolean | |
| public boolean | isTransitionedToDeferredLocks()
INTERNAL: Will return if the merge process has transitioned the active merge locks to deferred locks for readlock deadlock avoidance. |
| public Object | mergeChanges(Object object, ObjectChangeSet objectChangeSet, AbstractSession targetSession)
Recursively merge changes in the object dependent on the merge policy. |
| protected Object | mergeChangesForRefreshingRemoteObject(Object serverSideDomainObject)
Recursively merge the RMI clone from the server into the client unit of work working copy. |
| public void | mergeChangesFromChangeSet(UnitOfWorkChangeSet uowChangeSet)
INTERNAL: Merge the changes to all objects to session's cache. |
| protected Object | mergeChangesIntoDistributedCache(Object original, ObjectChangeSet changeSet)
Merge the changes specified within the changeSet into the cache. |
| protected Object | mergeChangesOfCloneIntoWorkingCopy(Object rmiClone)
Recursively merge to rmi clone into the unit of work working copy. |
| protected Object | mergeChangesOfOriginalIntoWorkingCopy(Object clone)
Recursively merge to original from its parent into the clone. |
| protected Object | mergeChangesOfWorkingCopyIntoOriginal(Object clone, ObjectChangeSet objectChangeSet)
Recursively merge to clone into the original in its parent. |
| protected CacheKey | mergeChangesOfWorkingCopyIntoOriginal(Object clone, ObjectChangeSet objectChangeSet, ClassDescriptor descriptor, AbstractSession targetSession, UnitOfWorkImpl unitOfWork)
Recursively merge to clone into the original in its parent. |
| public Object | mergeChangesOfWorkingCopyIntoRemote(Object clone)
Recursively merge changes in the object dependent on the merge policy. |
| public void | mergeCloneIntoWorkingCopy()
This can be used by the user for merging clones from RMI into the unit of work. |
| public void | mergeCloneWithReferencesIntoWorkingCopy()
This is used during the merge of dependent objects referencing independent objects, where you want the independent objects merged as well. |
| public void | mergeIntoDistributedCache()
This is used during cache synchronization to merge the changes into the distributed cache. |
| public Object | mergeNewObjectIntoCache(ObjectChangeSet changeSet)
Merge a change set for a new object into the cache. |
| public void | |
| public void | mergeWorkingCopyIntoOriginal()
This is used during the unit of work commit to merge changes into the parent. |
| public void | mergeWorkingCopyIntoRemote()
This is used during the unit of work commit to merge changes into the parent. |
| public void | |
| public void | |
| public Object | registerExistingObjectOfReadOnlyClassInNestedTransaction(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. |
| protected Object | registerObjectForMergeCloneIntoWorkingCopy(Object clone, boolean shouldForceCascade)
INTERNAL: When merging from a clone when the cache cannot be guaranteed the object must be first read if it is existing and not in the cache. |
| public void | registerRemovedNewObjectIfRequired(Object removedObject)
Determine if the object is a registered new object, and that this is a nested unit of work merge into the parent. |
| public void | |
| public void | |
| public void | |
| public void | setLockThread(Thread lockThread)
INTERNAL: Save the currentThread for later comparison to the activeThread in case they don't match |
| protected void | |
| public void | |
| protected void | |
| public void | setQueueNode(LinkedNode node)
INTENRAL: Used to set the node that this merge manager is stored in, within the WriteLocksManager write lockers queue |
| protected void | |
| public void | setWriteLockQueued(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. |
| public boolean | |
| public boolean | shouldCascadeByMapping()
Flag used to determine that the mappings should be checked for cascade requirements. |
| public boolean | |
| public boolean | |
| public boolean | shouldCascadeReferences()
Refreshes are based on the objects row, so all attributes of the object must be refreshed. |
| public boolean | |
| public boolean | shouldMergeChangesIntoDistributedCache()
INTERNAL: This happens when changes from an UnitOfWork is propagated to a distributed class. |
| public boolean | shouldMergeCloneIntoWorkingCopy()
This can be used by the user for merging clones from RMI into the unit of work. |
| public boolean | shouldMergeCloneWithReferencesIntoWorkingCopy()
This can be used by the user for merging remote EJB objects into the unit of work. |
| public boolean | |
| public boolean | shouldMergeWorkingCopyIntoOriginal()
This is used during the unit of work commit to merge changes into the parent. |
| public boolean | shouldMergeWorkingCopyIntoRemote()
INTERNAL: This happens when serialized remote unit of work has to be merged with local remote unit of work. |
| public boolean | |
| public void | transitionToDeferredLocks()
INTERNAL: Records that this merge manager has transitioned to use deferred locks during the merge. |
| protected void | updateCacheKeyProperties(UnitOfWorkImpl unitOfWork, CacheKey cacheKey, Object original, Object clone, ObjectChangeSet objectChangeSet, ClassDescriptor descriptor)
INTERNAL: Update CacheKey properties with new information. |
| acquiredLocks | back to summary |
|---|---|
| protected ArrayList<CacheKey> acquiredLocks Used to store the list of locks that this merge manager has acquired for this merge | |
| CASCADE_ALL_PARTS | back to summary |
|---|---|
| public static final int CASCADE_ALL_PARTS | |
| CASCADE_BY_MAPPING | back to summary |
|---|---|
| public static final int CASCADE_BY_MAPPING | |
| CASCADE_PRIVATE_PARTS | back to summary |
|---|---|
| public static final int CASCADE_PRIVATE_PARTS | |
| cascadePolicy | back to summary |
|---|---|
| protected int cascadePolicy Policy that determines how the merge will cascade to its object's parts. | |
| CHANGES_INTO_DISTRIBUTED_CACHE | back to summary |
|---|---|
| protected static final int CHANGES_INTO_DISTRIBUTED_CACHE | |
| CLONE_INTO_WORKING_COPY | back to summary |
|---|---|
| protected static final int CLONE_INTO_WORKING_COPY | |
| CLONE_WITH_REFS_INTO_WORKING_COPY | back to summary |
|---|---|
| protected static final int CLONE_WITH_REFS_INTO_WORKING_COPY | |
| forceCascade | back to summary |
|---|---|
| protected boolean forceCascade Force cascade merge even if a clone is already registered | |
| isForRefresh | back to summary |
|---|---|
| protected boolean isForRefresh records that this merge process is for a refresh | |
| isTransitionedToDeferredLocks | back to summary |
|---|---|
| protected boolean isTransitionedToDeferredLocks records that deferred locks have been employed for the merge process | |
| LOCK_ON_MERGE | back to summary |
|---|---|
| public static boolean LOCK_ON_MERGE Backdoor to disable merge locks. | |
| lockThread | back to summary |
|---|---|
| protected Thread lockThread save the currentThread for later comparison to the activeThread in case they don't match | |
| mergedNewObjects | back to summary |
|---|---|
| protected IdentityHashMap<Object, Object> mergedNewObjects Used to keep track of merged new objects. | |
| mergePolicy | back to summary |
|---|---|
| protected int mergePolicy Policy that determines merge type (i.e. merge is used for several usages). | |
| NO_CASCADE | back to summary |
|---|---|
| public static final int NO_CASCADE | |
| objectDescriptors | back to summary |
|---|---|
| protected Map<Object, ObjectDescriptor> objectDescriptors Used only while refreshing objects on remote session | |
| objectsAlreadyMerged | back to summary |
|---|---|
| protected Map<AbstractSession, Map<Object, Object>> objectsAlreadyMerged Used to unravel recursion. | |
| ORIGINAL_INTO_WORKING_COPY | back to summary |
|---|---|
| protected static final int ORIGINAL_INTO_WORKING_COPY | |
| queueNode | back to summary |
|---|---|
| protected LinkedNode queueNode Stores the node that holds this mergemanager within the WriteLocksManager queue | |
| REFRESH_REMOTE_OBJECT | back to summary |
|---|---|
| protected static final int REFRESH_REMOTE_OBJECT | |
| session | back to summary |
|---|---|
| protected AbstractSession session The unit of work merging for. | |
| systemTime | back to summary |
|---|---|
| protected long systemTime Stored so that all objects merged by a merge manager can have the same readTime. | |
| WORKING_COPY_INTO_ORIGINAL | back to summary |
|---|---|
| protected static final int WORKING_COPY_INTO_ORIGINAL | |
| WORKING_COPY_INTO_REMOTE | back to summary |
|---|---|
| protected static final int WORKING_COPY_INTO_REMOTE | |
| writeLockQueued | back to summary |
|---|---|
| protected Object writeLockQueued If this variable is not null then the mergemanager is waiting on a particular primary key | |
| MergeManager | back to summary |
|---|---|
| public MergeManager(AbstractSession session) | |
| cascadeAllParts | back to summary |
|---|---|
| public void cascadeAllParts() Cascade all parts, this is the default for the merge. | |
| cascadePrivateParts | back to summary |
|---|---|
| public void cascadePrivateParts() Cascade private parts, this can be used to merge clone when using RMI. | |
| checkNewObjectLockVersion | back to summary |
|---|---|
| public void checkNewObjectLockVersion(Object clone, 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. Raise an error instead of reincarnating the object. | |
| dontCascadeParts | back to summary |
|---|---|
| public void dontCascadeParts() Merge only direct parts, this can be used to merge clone when using RMI. | |
| getAcquiredLocks | back to summary |
|---|---|
| public ArrayList | |
| getCascadePolicy | back to summary |
|---|---|
| public int getCascadePolicy() | |
| getLockThread | back to summary |
|---|---|
| public Thread getLockThread() INTERNAL:
| |
| getMergedNewObjects | back to summary |
|---|---|
| public IdentityHashMap INTERNAL: Used to return a map containing new objects found through the registerObjectForMergeCloneIntoWorkingCopy method.
| |
| getMergedObject | back to summary |
|---|---|
| public Object getMergedObject(Object key, AbstractSession targetSession) | |
| getMergePolicy | back to summary |
|---|---|
| protected int getMergePolicy() | |
| getObjectDescriptors | back to summary |
|---|---|
| public Map | |
| getObjectsAlreadyMerged | back to summary |
|---|---|
| public Map | |
| getObjectToMerge | back to summary |
|---|---|
| public Object getObjectToMerge(Object sourceValue, ClassDescriptor descriptor, AbstractSession targetSession) | |
| getQueueNode | back to summary |
|---|---|
| public LinkedNode getQueueNode() INTENRAL: Used to get the node that this merge manager is stored in, within the WriteLocksManager write lockers queue | |
| getSession | back to summary |
|---|---|
| public AbstractSession getSession() | |
| getSystemTime | back to summary |
|---|---|
| public long getSystemTime() Get the stored value of the current time. This method lazily initializes so that read times for the same merge manager can all be set to the same read time | |
| getTargetVersionOfSourceObject | back to summary |
|---|---|
| public Object getTargetVersionOfSourceObject(Object source, ClassDescriptor descriptor, AbstractSession targetSession) Return the corresponding value that should be assigned to the target object for the source object. This value must be local to the targets object space. | |
| getWriteLockQueued | back to summary |
|---|---|
| public Object getWriteLockQueued() INTENRAL: Used to get the object that the merge manager is waiting on, in order to acquire locks | |
| isAlreadyMerged | back to summary |
|---|---|
| public boolean isAlreadyMerged(Object object, AbstractSession targetSession) | |
| isForRefresh | back to summary |
|---|---|
public boolean isForRefresh()
| |
| isTransitionedToDeferredLocks | back to summary |
|---|---|
| public boolean isTransitionedToDeferredLocks() INTERNAL: Will return if the merge process has transitioned the active merge locks to deferred locks for readlock deadlock avoidance. | |
| mergeChanges | back to summary |
|---|---|
| public Object mergeChanges(Object object, ObjectChangeSet objectChangeSet, AbstractSession targetSession) throws ValidationException Recursively merge changes in the object dependent on the merge policy. The map is used to resolve recursion. | |
| mergeChangesForRefreshingRemoteObject | back to summary |
|---|---|
| protected Object mergeChangesForRefreshingRemoteObject(Object serverSideDomainObject) Recursively merge the RMI clone from the server into the client unit of work working copy. This will only be called if the working copy exists. | |
| mergeChangesFromChangeSet | back to summary |
|---|---|
| public void mergeChangesFromChangeSet(UnitOfWorkChangeSet uowChangeSet) INTERNAL: Merge the changes to all objects to session's cache. | |
| mergeChangesIntoDistributedCache | back to summary |
|---|---|
| protected Object mergeChangesIntoDistributedCache(Object original, ObjectChangeSet changeSet) Merge the changes specified within the changeSet into the cache. The object passed in is the original object from the cache. | |
| mergeChangesOfCloneIntoWorkingCopy | back to summary |
|---|---|
| protected Object mergeChangesOfCloneIntoWorkingCopy(Object rmiClone) Recursively merge to rmi clone into the unit of work working copy. The map is used to resolve recursion. | |
| mergeChangesOfOriginalIntoWorkingCopy | back to summary |
|---|---|
| protected Object mergeChangesOfOriginalIntoWorkingCopy(Object clone) Recursively merge to original from its parent into the clone. The map is used to resolve recursion. | |
| mergeChangesOfWorkingCopyIntoOriginal | back to summary |
|---|---|
| protected Object mergeChangesOfWorkingCopyIntoOriginal(Object clone, ObjectChangeSet objectChangeSet) Recursively merge to clone into the original in its parent. The map is used to resolve recursion. | |
| mergeChangesOfWorkingCopyIntoOriginal | back to summary |
|---|---|
| protected CacheKey mergeChangesOfWorkingCopyIntoOriginal(Object clone, ObjectChangeSet objectChangeSet, ClassDescriptor descriptor, AbstractSession targetSession, UnitOfWorkImpl unitOfWork) Recursively merge to clone into the original in its parent. The map is used to resolve recursion. This is used to merge objects from the unit of work into the shared (or isolated) cache. | |
| mergeChangesOfWorkingCopyIntoRemote | back to summary |
|---|---|
| public Object mergeChangesOfWorkingCopyIntoRemote(Object clone) throws ValidationException Recursively merge changes in the object dependent on the merge policy. This merges changes from a remote unit of work back from the server into the original remote unit of work. This is meant to merge server-side changes such as sequence numbers, version numbers or events triggered changes. | |
| mergeCloneIntoWorkingCopy | back to summary |
|---|---|
| public void mergeCloneIntoWorkingCopy() This can be used by the user for merging clones from RMI into the unit of work. | |
| mergeCloneWithReferencesIntoWorkingCopy | back to summary |
|---|---|
| public void mergeCloneWithReferencesIntoWorkingCopy() This is used during the merge of dependent objects referencing independent objects, where you want the independent objects merged as well. | |
| mergeIntoDistributedCache | back to summary |
|---|---|
| public void mergeIntoDistributedCache() This is used during cache synchronization to merge the changes into the distributed cache. | |
| mergeNewObjectIntoCache | back to summary |
|---|---|
| public Object mergeNewObjectIntoCache(ObjectChangeSet changeSet) Merge a change set for a new object into the cache. This method will create a shell for the new object and then merge the changes from the change set into the object. The newly merged object will then be added to the cache. | |
| mergeOriginalIntoWorkingCopy | back to summary |
|---|---|
| public void mergeOriginalIntoWorkingCopy() This is used to revert changes to objects, or during refreshes. | |
| mergeWorkingCopyIntoOriginal | back to summary |
|---|---|
| public void mergeWorkingCopyIntoOriginal() This is used during the unit of work commit to merge changes into the parent. | |
| mergeWorkingCopyIntoRemote | back to summary |
|---|---|
| public void mergeWorkingCopyIntoRemote() This is used during the unit of work commit to merge changes into the parent. | |
| recordMerge | back to summary |
|---|---|
| public void recordMerge(Object key, Object value, AbstractSession targetSession) | |
| refreshRemoteObject | back to summary |
|---|---|
| public void refreshRemoteObject() INTERNAL: This is used to refresh remote session object | |
| registerExistingObjectOfReadOnlyClassInNestedTransaction | back to summary |
|---|---|
| public Object registerExistingObjectOfReadOnlyClassInNestedTransaction(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. | |
| registerObjectForMergeCloneIntoWorkingCopy | back to summary |
|---|---|
| protected Object registerObjectForMergeCloneIntoWorkingCopy(Object clone, boolean shouldForceCascade) INTERNAL: When merging from a clone when the cache cannot be guaranteed the object must be first read if it is existing and not in the cache. Otherwise no changes will be detected as the original state is missing. | |
| registerRemovedNewObjectIfRequired | back to summary |
|---|---|
| public void registerRemovedNewObjectIfRequired(Object removedObject) Determine if the object is a registered new object, and that this is a nested unit of work merge into the parent. In this case private mappings will register the object as being removed. | |
| setCascadePolicy | back to summary |
|---|---|
| public void setCascadePolicy(int cascadePolicy) | |
| setForceCascade | back to summary |
|---|---|
| public void setForceCascade(boolean forceCascade) | |
| setForRefresh | back to summary |
|---|---|
public void setForRefresh(boolean isforRefresh)
| |
| setLockThread | back to summary |
|---|---|
| public void setLockThread(Thread lockThread) INTERNAL: Save the currentThread for later comparison to the activeThread in case they don't match | |
| setMergePolicy | back to summary |
|---|---|
| protected void setMergePolicy(int mergePolicy) | |
| setObjectDescriptors | back to summary |
|---|---|
| public void setObjectDescriptors(Map<Object, ObjectDescriptor> objectDescriptors) | |
| setObjectsAlreadyMerged | back to summary |
|---|---|
| protected void setObjectsAlreadyMerged(Map<AbstractSession, Map<Object, Object>> objectsAlreadyMerged) | |
| setQueueNode | back to summary |
|---|---|
| public void setQueueNode(LinkedNode node) INTENRAL: Used to set the node that this merge manager is stored in, within the WriteLocksManager write lockers queue | |
| setSession | back to summary |
|---|---|
| protected void setSession(AbstractSession session) | |
| setWriteLockQueued | back to summary |
|---|---|
| public void setWriteLockQueued(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. | |
| shouldCascadeAllParts | back to summary |
|---|---|
| public boolean shouldCascadeAllParts() Flag used to determine if all parts should be cascaded | |
| shouldCascadeByMapping | back to summary |
|---|---|
| public boolean shouldCascadeByMapping() Flag used to determine that the mappings should be checked for cascade requirements. | |
| shouldCascadeParts | back to summary |
|---|---|
| public boolean shouldCascadeParts() Flag used to determine if any parts should be cascaded | |
| shouldCascadePrivateParts | back to summary |
|---|---|
| public boolean shouldCascadePrivateParts() Flag used to determine if any private parts should be cascaded | |
| shouldCascadeReferences | back to summary |
|---|---|
| public boolean shouldCascadeReferences() Refreshes are based on the objects row, so all attributes of the object must be refreshed. However merging from RMI, normally reference are made transient, so should not be merge unless specified. | |
| shouldForceCascade | back to summary |
|---|---|
| public boolean shouldForceCascade() This is used to cascade merge even if a clone is already registered. | |
| shouldMergeChangesIntoDistributedCache | back to summary |
|---|---|
| public boolean shouldMergeChangesIntoDistributedCache() INTERNAL: This happens when changes from an UnitOfWork is propagated to a distributed class. | |
| shouldMergeCloneIntoWorkingCopy | back to summary |
|---|---|
| public boolean shouldMergeCloneIntoWorkingCopy() This can be used by the user for merging clones from RMI into the unit of work. | |
| shouldMergeCloneWithReferencesIntoWorkingCopy | back to summary |
|---|---|
| public boolean shouldMergeCloneWithReferencesIntoWorkingCopy() This can be used by the user for merging remote EJB objects into the unit of work. | |
| shouldMergeOriginalIntoWorkingCopy | back to summary |
|---|---|
| public boolean shouldMergeOriginalIntoWorkingCopy() This is used to revert changes to objects, or during refreshes. | |
| shouldMergeWorkingCopyIntoOriginal | back to summary |
|---|---|
| public boolean shouldMergeWorkingCopyIntoOriginal() This is used during the unit of work commit to merge changes into the parent. | |
| shouldMergeWorkingCopyIntoRemote | back to summary |
|---|---|
| public boolean shouldMergeWorkingCopyIntoRemote() INTERNAL: This happens when serialized remote unit of work has to be merged with local remote unit of work. | |
| shouldRefreshRemoteObject | back to summary |
|---|---|
| public boolean shouldRefreshRemoteObject() INTERNAL: This is used to refresh objects on the remote session | |
| transitionToDeferredLocks | back to summary |
|---|---|
| public void transitionToDeferredLocks() INTERNAL: Records that this merge manager has transitioned to use deferred locks during the merge. | |
| updateCacheKeyProperties | back to summary |
|---|---|
| protected void updateCacheKeyProperties(UnitOfWorkImpl unitOfWork, CacheKey cacheKey, Object original, Object clone, ObjectChangeSet objectChangeSet, ClassDescriptor descriptor) INTERNAL: Update CacheKey properties with new information. This method is called if this code actually merges | |