Package org.verifyica.api
Class LockManager
java.lang.Object
org.verifyica.api.LockManager
Class to implement LockManager
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanMethod to return if a key is lockedstatic voidMethod to lock a keystatic booleanMethod to try to lock a keystatic booleanMethod to try to lock a keystatic voidMethod to unlock a key
-
Method Details
-
tryLock
Method to try to lock a key- Parameters:
key- key- Returns:
- true if the lock was free or locked by the current Thread, else false
-
tryLock
public static boolean tryLock(String key, long timeout, TimeUnit timeUnit) throws InterruptedException Method to try to lock a key- Parameters:
key- keytimeout- timeouttimeUnit- timeUnit- Returns:
- true if the lock was free or locked by the current Thread, else false
- Throws:
InterruptedException- InterruptedException
-
lock
Method to lock a key- Parameters:
key- key
-
unlock
Method to unlock a key- Parameters:
key- key
-
isLocked
Method to return if a key is locked- Parameters:
key- key- Returns:
- true if the key is locked, else false
-