Class LockManager

java.lang.Object
org.verifyica.api.LockManager

public class LockManager extends Object
Class to implement LockManager
  • Method Details

    • tryLock

      public static boolean tryLock(String key)
      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 - key
      timeout - timeout
      timeUnit - timeUnit
      Returns:
      true if the lock was free or locked by the current Thread, else false
      Throws:
      InterruptedException - InterruptedException
    • lock

      public static void lock(String key)
      Method to lock a key
      Parameters:
      key - key
    • unlock

      public static void unlock(String key)
      Method to unlock a key
      Parameters:
      key - key
    • isLocked

      public static boolean isLocked(String key)
      Method to return if a key is locked
      Parameters:
      key - key
      Returns:
      true if the key is locked, else false