Package org.alfresco.util
Class LockHelper
- java.lang.Object
-
- org.alfresco.util.LockHelper
-
public class LockHelper extends java.lang.Object
Helper to make trying for read-write locks simpler- Since:
- 4.1.7
- Author:
- Derek Hulley
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LockHelper.LockTryException
Exception generated when a lock try is unsuccessful
-
Constructor Summary
Constructors Constructor Description LockHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
tryLock(java.util.concurrent.locks.Lock lock, long timeoutMs, java.lang.String useCase)
Try to get a lock in the given number of milliseconds or get an exception
-
-
-
Method Detail
-
tryLock
public static void tryLock(java.util.concurrent.locks.Lock lock, long timeoutMs, java.lang.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
-
-