Class PassthroughUnitLock

java.lang.Object
com.pnfsoftware.jeb.core.units.PassthroughUnitLock
All Implemented Interfaces:
IUnitLock

@Ser public class PassthroughUnitLock extends Object implements IUnitLock
Singleton, immutable unit lock implementation that locks nothing.
  • Method Details

    • getInstance

      public static PassthroughUnitLock getInstance()
    • getDefaultBlockTimeoutMs

      public long getDefaultBlockTimeoutMs()
      Description copied from interface: IUnitLock
      Get the default wait time lock acquisition will block before throwing a UnitLockedException.
      Specified by:
      getDefaultBlockTimeoutMs in interface IUnitLock
      Returns:
      the allowed max blocking time; 0 means never fail (ie, fail if the lock is held by another thread); <0 means wait indefinitely
    • isLocked

      public boolean isLocked()
      Description copied from interface: IUnitLock
      Determine if the lock is held by _any_ thread. Purely indicative, do not use for synchronization.
      Specified by:
      isLocked in interface IUnitLock
      Returns:
    • isLockedByCurrentThread

      public boolean isLockedByCurrentThread()
      Description copied from interface: IUnitLock
      Determine if the lock is held by _this_ thread. Purely indicative, do not use for synchronization.
      Specified by:
      isLockedByCurrentThread in interface IUnitLock
      Returns:
    • verifyLocked

      public void verifyLocked()
      Description copied from interface: IUnitLock
      Verify that the lock is help by this thread, and raise an exception if not.
      Specified by:
      verifyLocked in interface IUnitLock
    • a

      public ACLock a()
      Description copied from interface: IUnitLock
      Attempt to acquire an auto-closable wrapper on this unit lock. If the lock cannot be acquired within the time frame defined by IUnitLock.getDefaultBlockTimeoutMs(), it will throw a UnitLockedException (see IUnitLock.getDefaultBlockTimeoutMs()).

      Best-practice: This method must be called in a try-with-resources.

      Specified by:
      a in interface IUnitLock
      Returns:
    • a

      public ACLock a(long blockTimeoutMs)
      Description copied from interface: IUnitLock
      Attempt to acquire an auto-closable wrapper on this unit lock. If the lock cannot be acquired within the provided time frame, the method will throw a UnitLockedException (see IUnitLock.getDefaultBlockTimeoutMs()).

      Best-practice: This method must be called in a try-with-resources.

      Specified by:
      a in interface IUnitLock
      Returns: