java.lang.Object
com.tccc.kos.ext.dispense.pipeline.ingredient.grants.LockGrantManager
All Implemented Interfaces:
PumpOpGrantManager

public class LockGrantManager extends Object implements PumpOpGrantManager
Grant manager that implements exclusive locks. To use this manger, specify a grant with the following format: lock:name where name represents the name of the lock. An operation with this grant will by blocked if another operation with the same lock name is being performed.
Since:
1.0
Version:
2024-07-24
  • Constructor Details

    • LockGrantManager

      public LockGrantManager()
  • Method Details

    • acquireGrants

      public boolean acquireGrants(PumpOp op)
      Description copied from interface: PumpOpGrantManager
      Acquire the specified grants for the specified pump op. If the grants can be acquired, any associated resources should be locked until released by calling releaseGrants() with the same pump op. Each registered manager will be called and if any one fails, all acquired grants up to that point will be released by a call to releaseGrants() . All calls are serialized so grant managers need not worry about concurrency or global deadlocks. If this manager does not manage any of the specified grants, it should still return true to indicate that no grants have been denied.
      Specified by:
      acquireGrants in interface PumpOpGrantManager
      Parameters:
      op - the pump operation containing the grants
      Returns:
      false if the grants could not be acquired
    • releaseGrants

      public void releaseGrants(PumpOp op)
      Description copied from interface: PumpOpGrantManager
      Called to release any grants acquired by the specified pump op.
      Specified by:
      releaseGrants in interface PumpOpGrantManager
      Parameters:
      op - the op used to acquire grants