Package org.alfresco.util
Class LockHelper
java.lang.Object
org.alfresco.util.LockHelper
Helper to make trying for read-write locks simpler
- Since:
- 4.1.7
- Author:
- Derek Hulley
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Exception generated when a lock try is unsuccessful -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
LockHelper
public LockHelper()
-
-
Method Details
-
tryLock
public static void tryLock(Lock lock, long timeoutMs, String useCase) throws LockHelper.LockTryException Try to get a lock in the given number of milliseconds or get an exception- Parameters:
lock
- the lock to trytimeoutMs
- the number of milliseconds to tryuseCase
-String
value which specifies description of use case when lock is needed- Throws:
LockHelper.LockTryException
- the exception if the time is exceeded or the thread is interrupted
-