Class DebugEnabledTimedLock

java.lang.Object
org.apache.nifi.util.concurrency.DebugEnabledTimedLock
All Implemented Interfaces:
DebuggableTimedLock

public class DebugEnabledTimedLock extends Object implements DebuggableTimedLock
  • Field Details

    • lock

      private final Lock lock
    • logger

      private final org.slf4j.Logger logger
    • lockTime

      private long lockTime
    • lockIterations

      private final Map<String,Long> lockIterations
    • lockNanos

      private final Map<String,Long> lockNanos
    • name

      private final String name
    • iterationFrequency

      private final int iterationFrequency
  • Constructor Details

    • DebugEnabledTimedLock

      public DebugEnabledTimedLock(Lock lock, String name, int iterationFrequency)
  • Method Details

    • tryLock

      public boolean tryLock()
      Specified by:
      tryLock in interface DebuggableTimedLock
      Returns:
      true if lock obtained; false otherwise
    • tryLock

      public boolean tryLock(long timeout, TimeUnit timeUnit)
      Specified by:
      tryLock in interface DebuggableTimedLock
      Parameters:
      timeout - duration to wait for lock
      timeUnit - unit to understand given duration
      Returns:
      true if lock obtained in time; false otherwise
    • lock

      public void lock()
      Specified by:
      lock in interface DebuggableTimedLock
    • unlock

      public void unlock(String task)
      Specified by:
      unlock in interface DebuggableTimedLock
      Parameters:
      task - to release the lock for