Class PumpEventService
java.lang.Object
com.kosdev.kos.ext.dispense.service.pumpevent.PumpEventService
Service that distributes pump lifecycle events.
- Since:
- 1
- Version:
- 1
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturn true if the specified pumps is in a running statebooleanlock(NozzlePipeline pipeline, Pump<?> pump, Object lock) Lock a pump relative to a pipeline referencing the specified lock object.booleanlockExists(Object lock) Return true if the specified lock exists.voidreplaceLine(Holder holder) Notify listeners that the line associated with the holder has been replaced.voidreplacePump(Pump<?> pump) Notify listeners that the specified pump has been replaced.voidIndicate that a pump has started, and fire a start event to registered listeners.voidIndicate that a pump has stopped, and fire a stop event to registered listeners.voidUnlock all pumps associated with the specified lock.
-
Field Details
-
TOPIC_REPLACE_PUMP
- See Also:
-
TOPIC_REPLACE_LINE
- See Also:
-
-
Method Details
-
lock
Lock a pump relative to a pipeline referencing the specified lock object. The lock object should be some type of transaction object that a group of pumps share, such as aPumpIntentobject. This object will be used to unlock all pumps locked against the object. This will generate a lock event to registered listeners.If a pump is locked more than once for the same lock it will be silently ignored. This allows applications to call lock on pumps more than once per lock, such as for each phase of a sequence of operations, which eliminates the need for applications to track locks.
Once locked, a pump should be unlocked before being locked again using a different lock.
- Parameters:
pipeline- the pipeline generating the eventpump- the pump to locklock- the lock object- Returns:
- true if the pump was successfully locked
- Since:
- 1
-
unlock
Unlock all pumps associated with the specified lock. This will generate an unlock event to registered listeners. If any of the pumps are still in a started state, a stop event will be generated before the unlock event. This ensures event symmetry.- Parameters:
lock- the lock object to release- Since:
- 1
-
lockExists
Return true if the specified lock exists.- Parameters:
lock- the lock object to release- Since:
- 1
-
isRunning
Return true if the specified pumps is in a running state- Parameters:
pump- the pump to check- Since:
- 1
-
start
Indicate that a pump has started, and fire a start event to registered listeners. If the pump is already started, this call will be ignored. This allows applications to safely call start multiple times.- Parameters:
pump- the pump that started- Since:
- 1
-
stop
Indicate that a pump has stopped, and fire a stop event to registered listeners.- Parameters:
pump- the pump that stopped- Since:
- 1
-
replacePump
Notify listeners that the specified pump has been replaced.- Parameters:
pump- the pump that has been replaced- Since:
- 1
-
replaceLine
Notify listeners that the line associated with the holder has been replaced.- Parameters:
holder- the holder with the line that was replaced- Since:
- 1
-