Top Description Fields Constructors Methods
org.eclipse.persistence.internal.helper

public Class ConcurrencyManager

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
org.eclipse.persistence.internal.identitymaps.CacheKey
Imports
java.io.Serializable, .StringWriter, java.util.ArrayList, .Arrays, .Date, .Enumeration, .HashMap, .HashSet, .IdentityHashMap, .List, .Map, .Set, .Vector, java.util.concurrent.ConcurrentHashMap, java.util.concurrent.atomic.AtomicInteger, .AtomicLong, org.eclipse.persistence.config.SystemProperties, org.eclipse.persistence.exceptions.ConcurrencyException, org.eclipse.persistence.internal.identitymaps.CacheKey, org.eclipse.persistence.internal.localization.ToStringLocalization, .TraceLocalization, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, org.eclipse.persistence.logging.AbstractSessionLog, .SessionLog

INTERNAL:

Purpose: To maintain concurrency for a particular task. It is a wrappers of a semaphore that allows recursive waits by a single thread.

Responsibilities:

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final String
private static final String
protected transient volatile Thread
private static final AtomicLong
private final Date
private final long
public static final Map<Thread, DeferredLockManager>
protected AtomicInteger
protected boolean
protected AtomicInteger
protected AtomicInteger
private static final Map<Thread, ReadLockManager>
protected static boolean
protected Exception
private static final Map<Thread, ConcurrencyManager>
private static final Map<Thread, String>
private static final Map<Thread, ConcurrencyManager>
private static final Map<Thread, String>
private static final Set<Thread>
private static final Map<Thread, String>
private final AtomicLong
private final AtomicLong
private final AtomicLong

Constructor Summary

AccessConstructor and Description
public
ConcurrencyManager()

Initialize the newly allocated instance of this class.

Method Summary

Modifier and TypeMethod and Description
public void
acquire()

Wait for all threads except the active thread.

public synchronized void
acquire(boolean forMerge)

Wait for all threads except the active thread.

public void
acquireDeferredLock()

Add deferred lock into a hashtable to avoid deadlock

public synchronized boolean
acquireIfUnownedNoWait(boolean forMerge)

If the activeThread is not set, acquire it and return true.

public boolean
acquireNoWait()

If the lock is not acquired already acquire it and return true.

public synchronized boolean
acquireNoWait(boolean forMerge)

If the lock is not acquired already acquire it and return true.

public synchronized void
acquireReadLock()

Wait on any writer.

public synchronized boolean
acquireReadLockNoWait()

If this is acquired return false otherwise acquire readlock and return true

public synchronized boolean
acquireWithWait(boolean forMerge, int wait)

If the lock is not acquired already acquire it and return true.

protected void
addReadLockToReadLockManager()

The current thread has incremented the number of readers on the current cache key.

public void
checkDeferredLock()

Check the lock state, if locked, acquire and release a deferred lock.

public void
checkReadLock()

Check the lock state, if locked, acquire and release a read lock.

public static void
public static void
enrichStringBuildingExplainWhyThreadIsStuckInIsBuildObjectOnThreadComplete(List<Thread>
This the chaing threads that were expanded as we went down with the recursion
chainOfThreadsExpandedInRecursion
,
ConcurrencyManager
this is a lock that was deferred either by current thread or by a thread that is also itself waiting around . This lock is what is causing us ultimately to return FALSE, because the lock is still ACUIRED so not yet free. And the thread that owns it is also still not finished yet.
finalDeferredLockCausingTrouble
,
Thread
this is the thread that was spotted as owning/being actively owning the the deferred lock. So we can consider this thread as being the ultimate cause of why the current thread and perhaps a hole chaing of related threads are not evolving. But certainly the current thread.
activeThreadOnDeferredLock
,
boolean
Some threads have deferred lock managers some not. Not clear when they do. But threads doing object building typically end up creating a deferred lock manager when they find themselves unable to acquire an object and need to defer on the cache key.
hasDeferredLockManager
,
StringBuilder
this is what we want to populate it will allow us to build a trace to explain why the thread on the wait for deferred lock is going nowhere. This trace will be quite important to help us interpret the massive dumps since it is quite typical to find threads in this state.
justification
)

When the recursive algorithm decides to return false it is because it is confronted with a cache key that had to be deferred.

public Thread
getActiveThread()

Return the active thread.

public Date
public long
public static DeferredLockManager
getDeferredLockManager(Thread thread)

Return the deferred lock manager from the thread

protected static Map<Thread, DeferredLockManager>
getDeferredLockManagers()

Return the deferred lock manager hashtable (thread - DeferredLockManager).

public int
getDepth()

Return the current depth of the active thread.

public int
getNumberOfReaders()

Number of writer that want the lock.

public int
getNumberOfWritersWaiting()

Number of writers that want the lock.

private static String
protected static ReadLockManager

Returns:

Never null if the read lock manager does not yet exist for the current thread. otherwise its read log manager is returned.
getReadLockManager
(Thread
The thread for which we want to have look at the acquired read locks.
thread
)

The method is not synchronized because for now we assume that each thread will ask for its own lock manager.

protected static ReadLockManager

Returns:

the read lock manager for the current thread.
getReadLockManagerEnsureResultIsNotNull
(Thread
the thread wanting its read lock manager
thread
)

Same as getReadLockManager(Thread) but in this case a not null result is ensured

protected static Map<Thread, ReadLockManager>
getReadLockManagers()

Return the deferred lock manager hashtable (thread - DeferredLockManager).

public Exception
public static Map<Thread, ConcurrencyManager>
public static Map<Thread, String>
public static Map<Thread, ConcurrencyManager>
public static Map<Thread, String>
public static Set<Thread>
public static Map<Thread, String>
public long
public long
public long
protected static Map<Thread, DeferredLockManager>
initializeDeferredLockManagers()

Init the deferred lock managers (thread - DeferredLockManager).

public boolean
isAcquired()

Return if a thread has acquire this manager.

public static boolean

Returns:

true if object is complete
isBuildObjectOnThreadComplete
(Thread
the current thread to be explored. It starts by being the thread that it is stuck but then it evolves to be other that have acquired locks our main thread was needing but whcich themslves are stuck... threads in the deffered lock chain that are going nowhere themselves.
thread
,
Map<Thread, Thread>
this prevents the algorithm going into an infinite loop of expanding the same thread more than once.
recursiveSet
,
List<Thread>
this starts by being a basket containing the current thread, but each time we go deeper it evolves to contain the thread we will explore next.
parentChainOfThreads
,
boolean deadLockDiagnostic)

Check if the deferred locks of a thread are all released.

public boolean
isLockedByMergeManager()

INTERNAL: Used byt the refresh process to determine if this concurrency manager is locked by the merge process.

public boolean
isNested()

Return if this manager is within a nested acquire.

public void
public void
putThreadAsWaitingToAcquireLockForReading(Thread currentThread, String
metadata to help us debug trace leaking. If we start blowing up threads we do not want the traces created by the current thread to remain.
methodName
)

The thread is trying to acquire a read lock but it is not being able to make process on getting the read lock.

public void
putThreadAsWaitingToAcquireLockForWriting(Thread thread, String methodName)

Normally this mehtod should only be called from withing the concurrency manager.

public synchronized void
release()

Decrement the depth for the active thread.

public void
releaseAllLocksAcquiredByThread(DeferredLockManager
the deferred lock manager
lockManager
)

For the thread to release all of its locks.

public void
releaseDeferredLock()

Release the deferred lock.

public synchronized void
releaseReadLock()

Decrement the number of readers.

public static DeferredLockManager
removeDeferredLockManager(Thread thread)

Remove the deferred lock manager for the thread

protected void
removeReadLockFromReadLockManager()

The current thread is about to decrement the number of readers in cache key.

protected static void
removeReadLockManagerIfEmpty(Thread
the thread that wants its read lock manager destroyed if it is empty.
thread
)

Just like we see that the satic map of deffered locks is cleared of cache values for the current thread we also want to try to keep the static map of acquired read locks by a thread light weight by removing the association between the current thread and a read lock manager whenever the read lock manager becomes empty.

public void
public void
removeThreadNoLongerWaitingToAcquireLockForWriting(Thread thread)

The thread has acquired the lock for writing or decided to defer acquiring the lock putting this lock into its deferred lock list.

public void
setActiveThread(Thread activeThread)

Set the active thread.

protected void
setDepth(int depth)

Set the current depth of the active thread.

public void
setIsLockedByMergeManager(boolean state)

INTERNAL: Used by the mergemanager to let the read know not to refresh this object as it is being loaded by the merge process.

public static void
setJustificationWhyMethodIsBuildingObjectCompleteReturnsFalse(String
a string that helps us understand why the recursive algorithm returned false, building object is not yet complete.
justification
)

See clearJustificationWhyMethodIsBuildingObjectCompleteReturnsFalse() in this case we want to store the justification computed by the enrichStringBuildingExplainWhyThreadIsStuckInIsBuildObjectOnThreadComplete(List, ConcurrencyManager, Thread, boolean, StringBuilder)

protected void
setNumberOfReaders(int numberOfReaders)

Track the number of readers.

protected void
setNumberOfWritersWaiting(int numberOfWritersWaiting)

Number of writers that want the lock.

public static void
setShouldTrackStack(boolean shouldTrackStack)

INTERNAL: This can be set during debugging to record the stacktrace when a lock is acquired.

public void
public static boolean
public String
toString()

Overrides java.lang.Object.toString.

Print the nested depth.
public synchronized void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

ACQUIRE_DEFERRED_LOCK_METHOD_NAMEback to summary
private static final String ACQUIRE_DEFERRED_LOCK_METHOD_NAME
ACQUIRE_METHOD_NAMEback to summary
private static final String ACQUIRE_METHOD_NAME
ACQUIRE_READ_LOCK_METHOD_NAMEback to summary
private static final String ACQUIRE_READ_LOCK_METHOD_NAME
ACQUIRE_WITH_WAIT_METHOD_NAMEback to summary
private static final String ACQUIRE_WITH_WAIT_METHOD_NAME
activeThreadback to summary
protected transient volatile Thread activeThread
CONCURRENCY_MANAGER_IDback to summary
private static final AtomicLong CONCURRENCY_MANAGER_ID
concurrencyManagerCreationDateback to summary
private final Date concurrencyManagerCreationDate
concurrencyManagerIdback to summary
private final long concurrencyManagerId
DEFERRED_LOCK_MANAGERSback to summary
public static final Map<Thread, DeferredLockManager> DEFERRED_LOCK_MANAGERS
depthback to summary
protected AtomicInteger depth
lockedByMergeManagerback to summary
protected boolean lockedByMergeManager
numberOfReadersback to summary
protected AtomicInteger numberOfReaders
numberOfWritersWaitingback to summary
protected AtomicInteger numberOfWritersWaiting
READ_LOCK_MANAGERSback to summary
private static final Map<Thread, ReadLockManager> READ_LOCK_MANAGERS
shouldTrackStackback to summary
protected static boolean shouldTrackStack
stackback to summary
protected Exception stack
THREADS_TO_WAIT_ON_ACQUIREback to summary
private static final Map<Thread, ConcurrencyManager> THREADS_TO_WAIT_ON_ACQUIRE
THREADS_TO_WAIT_ON_ACQUIRE_NAME_OF_METHOD_CREATING_TRACEback to summary
private static final Map<Thread, String> THREADS_TO_WAIT_ON_ACQUIRE_NAME_OF_METHOD_CREATING_TRACE
THREADS_TO_WAIT_ON_ACQUIRE_READ_LOCKback to summary
private static final Map<Thread, ConcurrencyManager> THREADS_TO_WAIT_ON_ACQUIRE_READ_LOCK
THREADS_TO_WAIT_ON_ACQUIRE_READ_LOCK_NAME_OF_METHOD_CREATING_TRACEback to summary
private static final Map<Thread, String> THREADS_TO_WAIT_ON_ACQUIRE_READ_LOCK_NAME_OF_METHOD_CREATING_TRACE
THREADS_WAITING_TO_RELEASE_DEFERRED_LOCKSback to summary
private static final Set<Thread> THREADS_WAITING_TO_RELEASE_DEFERRED_LOCKS
THREADS_WAITING_TO_RELEASE_DEFERRED_LOCKS_BUILD_OBJECT_COMPLETE_GOES_NOWHEREback to summary
private static final Map<Thread, String> THREADS_WAITING_TO_RELEASE_DEFERRED_LOCKS_BUILD_OBJECT_COMPLETE_GOES_NOWHERE
totalNumberOfKeysAcquiredForReadingback to summary
private final AtomicLong totalNumberOfKeysAcquiredForReading
totalNumberOfKeysReleasedForReadingback to summary
private final AtomicLong totalNumberOfKeysReleasedForReading
totalNumberOfKeysReleasedForReadingBlewUpExceptionDueToCacheKeyHavingReachedCounterZeroback to summary
private final AtomicLong totalNumberOfKeysReleasedForReadingBlewUpExceptionDueToCacheKeyHavingReachedCounterZero

Constructor Detail

ConcurrencyManagerback to summary
public ConcurrencyManager()

Initialize the newly allocated instance of this class. Set the depth to zero.

Method Detail

acquireback to summary
public void acquire() throws ConcurrencyException

Wait for all threads except the active thread. If the active thread just increment the depth. This should be called before entering a critical section.

acquireback to summary
public synchronized void acquire(boolean forMerge) throws ConcurrencyException

Wait for all threads except the active thread. If the active thread just increment the depth. This should be called before entering a critical section. called with true from the merge process, if true then the refresh will not refresh the object

acquireDeferredLockback to summary
public void acquireDeferredLock() throws ConcurrencyException

Add deferred lock into a hashtable to avoid deadlock

acquireIfUnownedNoWaitback to summary
public synchronized boolean acquireIfUnownedNoWait(boolean forMerge) throws ConcurrencyException

If the activeThread is not set, acquire it and return true. If the activeThread is set, it has been acquired already, return false. Added for Bug 5840635 Call with true from the merge process, if true then the refresh will not refresh the object.

acquireNoWaitback to summary
public boolean acquireNoWait() throws ConcurrencyException

If the lock is not acquired already acquire it and return true. If it has been acquired already return false Added for CR 2317

acquireNoWaitback to summary
public synchronized boolean acquireNoWait(boolean forMerge) throws ConcurrencyException

If the lock is not acquired already acquire it and return true. If it has been acquired already return false Added for CR 2317 called with true from the merge process, if true then the refresh will not refresh the object

acquireReadLockback to summary
public synchronized void acquireReadLock() throws ConcurrencyException

Wait on any writer. Allow concurrent reads.

acquireReadLockNoWaitback to summary
public synchronized boolean acquireReadLockNoWait()

If this is acquired return false otherwise acquire readlock and return true

acquireWithWaitback to summary
public synchronized boolean acquireWithWait(boolean forMerge, int wait) throws ConcurrencyException

If the lock is not acquired already acquire it and return true. If it has been acquired already return false Added for CR 2317 called with true from the merge process, if true then the refresh will not refresh the object

addReadLockToReadLockManagerback to summary
protected void addReadLockToReadLockManager()

The current thread has incremented the number of readers on the current cache key. It also wants to record into the read lock manager that this thread has acquired the cache key. This method should be user in all places where the cache key nunber of readers is incremented.

checkDeferredLockback to summary
public void checkDeferredLock() throws ConcurrencyException

Check the lock state, if locked, acquire and release a deferred lock. This optimizes out the normal deferred-lock check if not locked.

checkReadLockback to summary
public void checkReadLock() throws ConcurrencyException

Check the lock state, if locked, acquire and release a read lock. This optimizes out the normal read-lock check if not locked.

clearJustificationWhyMethodIsBuildingObjectCompleteReturnsFalseback to summary
public static void clearJustificationWhyMethodIsBuildingObjectCompleteReturnsFalse()

Clear the justification why the isBuildObjectOnThreadComplete(Thread, Map, List, boolean) is going nowhere.

WHEN TO INVOKE:
Should be invoked if we decide to blowup a thread with the explosive approach, for a thread in wait for release deferred lock. We do not want to keep traces of threads that left eclipselink code.
Should be infokved when the algorithm returns TRUE - build object is complete.
Should be invoked when we are not yet stuck for sufficient time and the release defferred logic algorithm is using the isBuildObjectOnThreadComplete(Thread, Map, List, boolean) instead of the more verbose and slower isBuildObjectOnThreadComplete(Thread, Map, List, boolean).

enrichStringBuildingExplainWhyThreadIsStuckInIsBuildObjectOnThreadCompleteback to summary
public static void enrichStringBuildingExplainWhyThreadIsStuckInIsBuildObjectOnThreadComplete(List<Thread> chainOfThreadsExpandedInRecursion, ConcurrencyManager finalDeferredLockCausingTrouble, Thread activeThreadOnDeferredLock, boolean hasDeferredLockManager, StringBuilder justification)

When the recursive algorithm decides to return false it is because it is confronted with a cache key that had to be deferred. And the cache key is either being owned by a thread that did not flage itsef as being finished and waiting in the wait for deferred locks. Or the thread that ows the cache key is not playing nice - and not using deferred locks - so it has acquire the cache key, it is going about its business (e.g. committing a transaction or perhaps doing object building. Normally, but not always, in object building threads do have a lock manager, but sometimes not when they agressive acquire lock policy. )

Parameters
chainOfThreadsExpandedInRecursion:List<Thread>

This the chaing threads that were expanded as we went down with the recursion

finalDeferredLockCausingTrouble:ConcurrencyManager

this is a lock that was deferred either by current thread or by a thread that is also itself waiting around . This lock is what is causing us ultimately to return FALSE, because the lock is still ACUIRED so not yet free. And the thread that owns it is also still not finished yet.

activeThreadOnDeferredLock:Thread

this is the thread that was spotted as owning/being actively owning the the deferred lock. So we can consider this thread as being the ultimate cause of why the current thread and perhaps a hole chaing of related threads are not evolving. But certainly the current thread.

hasDeferredLockManager:boolean

Some threads have deferred lock managers some not. Not clear when they do. But threads doing object building typically end up creating a deferred lock manager when they find themselves unable to acquire an object and need to defer on the cache key.

justification:StringBuilder

this is what we want to populate it will allow us to build a trace to explain why the thread on the wait for deferred lock is going nowhere. This trace will be quite important to help us interpret the massive dumps since it is quite typical to find threads in this state.

getActiveThreadback to summary
public Thread getActiveThread()

Return the active thread.

getConcurrencyManagerCreationDateback to summary
public Date getConcurrencyManagerCreationDate()

Getter for concurrencyManagerCreationDate

getConcurrencyManagerIdback to summary
public long getConcurrencyManagerId()

Getter for concurrencyManagerId

getDeferredLockManagerback to summary
public static DeferredLockManager getDeferredLockManager(Thread thread)

Return the deferred lock manager from the thread

getDeferredLockManagersback to summary
protected static Map<Thread, DeferredLockManager> getDeferredLockManagers()

Return the deferred lock manager hashtable (thread - DeferredLockManager).

getDepthback to summary
public int getDepth()

Return the current depth of the active thread.

getNumberOfReadersback to summary
public int getNumberOfReaders()

Number of writer that want the lock. This is used to ensure that a writer is not starved.

getNumberOfWritersWaitingback to summary
public int getNumberOfWritersWaiting()

Number of writers that want the lock. This is used to ensure that a writer is not starved.

getPropertyRecordStackOnLockback to summary
private static String getPropertyRecordStackOnLock()
getReadLockManagerback to summary
protected static ReadLockManager getReadLockManager(Thread thread)

The method is not synchronized because for now we assume that each thread will ask for its own lock manager. If we were writing a dead lock detection mechanism then a ThreadA could be trying understand the ReadLocks of a ThreadB and this would no longer be true.

Parameters
thread:Thread

The thread for which we want to have look at the acquired read locks.

Returns:ReadLockManager

Never null if the read lock manager does not yet exist for the current thread. otherwise its read log manager is returned.

getReadLockManagerEnsureResultIsNotNullback to summary
protected static ReadLockManager getReadLockManagerEnsureResultIsNotNull(Thread thread)

Same as getReadLockManager(Thread) but in this case a not null result is ensured

Parameters
thread:Thread

the thread wanting its read lock manager

Returns:ReadLockManager

the read lock manager for the current thread.

getReadLockManagersback to summary
protected static Map<Thread, ReadLockManager> getReadLockManagers()

Return the deferred lock manager hashtable (thread - DeferredLockManager).

getStackback to summary
public Exception getStack()
getThreadsToWaitOnAcquireback to summary
public static Map<Thread, ConcurrencyManager> getThreadsToWaitOnAcquire()

Getter for THREADS_TO_WAIT_ON_ACQUIRE

getThreadsToWaitOnAcquireMethodNameback to summary
public static Map<Thread, String> getThreadsToWaitOnAcquireMethodName()

Getter for THREADS_TO_WAIT_ON_ACQUIRE_NAME_OF_METHOD_CREATING_TRACE

getThreadsToWaitOnAcquireReadLockback to summary
public static Map<Thread, ConcurrencyManager> getThreadsToWaitOnAcquireReadLock()

Getter for THREADS_TO_WAIT_ON_ACQUIRE_READ_LOCK

getThreadsToWaitOnAcquireReadLockMethodNameback to summary
public static Map<Thread, String> getThreadsToWaitOnAcquireReadLockMethodName()

Getter for THREADS_TO_WAIT_ON_ACQUIRE_READ_LOCK_NAME_OF_METHOD_CREATING_TRACE

getThreadsWaitingToReleaseDeferredLocksback to summary
public static Set<Thread> getThreadsWaitingToReleaseDeferredLocks()

Getter for THREADS_WAITING_TO_RELEASE_DEFERRED_LOCKS

getThreadsWaitingToReleaseDeferredLocksJustificationback to summary
public static Map<Thread, String> getThreadsWaitingToReleaseDeferredLocksJustification()

Getter for THREADS_WAITING_TO_RELEASE_DEFERRED_LOCKS_BUILD_OBJECT_COMPLETE_GOES_NOWHERE

getTotalNumberOfKeysAcquiredForReadingback to summary
public long getTotalNumberOfKeysAcquiredForReading()

Getter for totalNumberOfKeysAcquiredForReading

getTotalNumberOfKeysReleasedForReadingback to summary
public long getTotalNumberOfKeysReleasedForReading()

Getter for totalNumberOfKeysReleasedForReading

getTotalNumberOfKeysReleasedForReadingBlewUpExceptionDueToCacheKeyHavingReachedCounterZeroback to summary
public long getTotalNumberOfKeysReleasedForReadingBlewUpExceptionDueToCacheKeyHavingReachedCounterZero()

Getter for totalNumberOfKeysReleasedForReadingBlewUpExceptionDueToCacheKeyHavingReachedCounterZero

initializeDeferredLockManagersback to summary
protected static Map<Thread, DeferredLockManager> initializeDeferredLockManagers()

Init the deferred lock managers (thread - DeferredLockManager).

isAcquiredback to summary
public boolean isAcquired()

Return if a thread has acquire this manager.

isBuildObjectOnThreadCompleteback to summary
public static boolean isBuildObjectOnThreadComplete(Thread thread, Map<Thread, Thread> recursiveSet, List<Thread> parentChainOfThreads, boolean deadLockDiagnostic)

Check if the deferred locks of a thread are all released. Should write dead lock diagnostic information into the THREADS_WAITING_TO_RELEASE_DEFERRED_LOCKS_BUILD_OBJECT_COMPLETE_GOES_NOWHERE.

Parameters
thread:Thread

the current thread to be explored. It starts by being the thread that it is stuck but then it evolves to be other that have acquired locks our main thread was needing but whcich themslves are stuck... threads in the deffered lock chain that are going nowhere themselves.

recursiveSet:Map<Thread, Thread>

this prevents the algorithm going into an infinite loop of expanding the same thread more than once.

parentChainOfThreads:List<Thread>

this starts by being a basket containing the current thread, but each time we go deeper it evolves to contain the thread we will explore next.

Returns:boolean

true if object is complete

isLockedByMergeManagerback to summary
public boolean isLockedByMergeManager()

INTERNAL: Used byt the refresh process to determine if this concurrency manager is locked by the merge process. If it is then the refresh should not refresh the object

isNestedback to summary
public boolean isNested()

Return if this manager is within a nested acquire.

putDeferredLockback to summary
public void putDeferredLock(Thread thread, DeferredLockManager lockManager)
putThreadAsWaitingToAcquireLockForReadingback to summary
public void putThreadAsWaitingToAcquireLockForReading(Thread currentThread, String methodName)

The thread is trying to acquire a read lock but it is not being able to make process on getting the read lock.

Parameters
methodName:String

metadata to help us debug trace leaking. If we start blowing up threads we do not want the traces created by the current thread to remain.

putThreadAsWaitingToAcquireLockForWritingback to summary
public void putThreadAsWaitingToAcquireLockForWriting(Thread thread, String methodName)

Normally this mehtod should only be called from withing the concurrency manager. However the write lock manager while it is building clones also does some while loop waiting to try to acquire a cache key this acquiring logic is not being managed directly inside of the wait manager.

releaseback to summary
public synchronized void release() throws ConcurrencyException

Decrement the depth for the active thread. Assume the current thread is the active one. Raise an error if the depth become < 0. The notify will release the first thread waiting on the object, if no threads are waiting it will do nothing.

releaseAllLocksAcquiredByThreadback to summary
public void releaseAllLocksAcquiredByThread(DeferredLockManager lockManager)

For the thread to release all of its locks.

Parameters
lockManager:DeferredLockManager

the deferred lock manager

releaseDeferredLockback to summary
public void releaseDeferredLock() throws ConcurrencyException

Release the deferred lock. This uses a deadlock detection and resolution algorithm to avoid cache deadlocks. The deferred lock manager keeps track of the lock for a thread, so that other thread know when a deadlock has occurred and can resolve it.

releaseReadLockback to summary
public synchronized void releaseReadLock() throws ConcurrencyException

Decrement the number of readers. Used to allow concurrent reads.

removeDeferredLockManagerback to summary
public static DeferredLockManager removeDeferredLockManager(Thread thread)

Remove the deferred lock manager for the thread

removeReadLockFromReadLockManagerback to summary
protected void removeReadLockFromReadLockManager()

The current thread is about to decrement the number of readers in cache key. The thread also wants to update the read lock manager and remove the cache key that has previously been aquired from there.

removeReadLockManagerIfEmptyback to summary
protected static void removeReadLockManagerIfEmpty(Thread thread)

Just like we see that the satic map of deffered locks is cleared of cache values for the current thread we also want to try to keep the static map of acquired read locks by a thread light weight by removing the association between the current thread and a read lock manager whenever the read lock manager becomes empty.

Parameters
thread:Thread

the thread that wants its read lock manager destroyed if it is empty.

removeThreadNoLongerWaitingToAcquireLockForReadingback to summary
public void removeThreadNoLongerWaitingToAcquireLockForReading(Thread thread)
removeThreadNoLongerWaitingToAcquireLockForWritingback to summary
public void removeThreadNoLongerWaitingToAcquireLockForWriting(Thread thread)

The thread has acquired the lock for writing or decided to defer acquiring the lock putting this lock into its deferred lock list.

setActiveThreadback to summary
public void setActiveThread(Thread activeThread)

Set the active thread.

setDepthback to summary
protected void setDepth(int depth)

Set the current depth of the active thread.

setIsLockedByMergeManagerback to summary
public void setIsLockedByMergeManager(boolean state)

INTERNAL: Used by the mergemanager to let the read know not to refresh this object as it is being loaded by the merge process.

setJustificationWhyMethodIsBuildingObjectCompleteReturnsFalseback to summary
public static void setJustificationWhyMethodIsBuildingObjectCompleteReturnsFalse(String justification)

See clearJustificationWhyMethodIsBuildingObjectCompleteReturnsFalse() in this case we want to store the justification computed by the enrichStringBuildingExplainWhyThreadIsStuckInIsBuildObjectOnThreadComplete(List, ConcurrencyManager, Thread, boolean, StringBuilder)

Parameters
justification:String

a string that helps us understand why the recursive algorithm returned false, building object is not yet complete.

setNumberOfReadersback to summary
protected void setNumberOfReaders(int numberOfReaders)

Track the number of readers.

setNumberOfWritersWaitingback to summary
protected void setNumberOfWritersWaiting(int numberOfWritersWaiting)

Number of writers that want the lock. This is used to ensure that a writer is not starved.

setShouldTrackStackback to summary
public static void setShouldTrackStack(boolean shouldTrackStack)

INTERNAL: This can be set during debugging to record the stacktrace when a lock is acquired. Then once IdentityMapAccessor.printIdentityMapLocks() is called the stack call for each lock will be printed as well. Because locking issues are usually quite time sensitive setting this flag may inadvertently remove the deadlock because of the change in timings. There is also a system level property for this setting. "eclipselink.cache.record-stack-on-lock"

setStackback to summary
public void setStack(Exception stack)
shouldTrackStackback to summary
public static boolean shouldTrackStack()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Print the nested depth.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

Annotations
@Override
transitionToDeferredLockback to summary
public synchronized void transitionToDeferredLock()