Class LockGrantManager
java.lang.Object
com.tccc.kos.ext.dispense.pipeline.ingredient.grants.LockGrantManager
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
acquireGrants
(PumpOp op) Acquire the specified grants for the specified pump op.void
releaseGrants
(PumpOp op) Called to release any grants acquired by the specified pump op.
-
Constructor Details
-
LockGrantManager
public LockGrantManager()
-
-
Method Details
-
acquireGrants
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 callingreleaseGrants()
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 toreleaseGrants()
. 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 interfacePumpOpGrantManager
- Parameters:
op
- the pump operation containing the grants- Returns:
- false if the grants could not be acquired
-
releaseGrants
Description copied from interface:PumpOpGrantManager
Called to release any grants acquired by the specified pump op.- Specified by:
releaseGrants
in interfacePumpOpGrantManager
- Parameters:
op
- the op used to acquire grants
-