Class PumpEventService
java.lang.Object
com.tccc.kos.commons.util.ready.ReadyBean
com.tccc.kos.commons.core.service.AbstractService
com.tccc.kos.ext.dispense.service.pumpevent.PumpEventService
- All Implemented Interfaces:
com.tccc.kos.commons.core.context.CtxEventListener
,com.tccc.kos.commons.core.service.handle.ContextHandleAware
,com.tccc.kos.commons.core.service.handle.HandleAware
,com.tccc.kos.commons.util.ready.Ready
,com.tccc.kos.commons.util.ready.ReadyListener
public final class PumpEventService
extends com.tccc.kos.commons.core.service.AbstractService
Service that distributes pump lifecycle events.
- Since:
- 1.0
- Version:
- 2024-08-22
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
lock
(NozzlePipeline pipeline, Pump<?> pump, Object lock) Lock a pump relative to a pipeline referencing the specified lock object.boolean
lockExists
(Object lock) Return true if the specified lock exists.void
replaceLine
(Holder holder) Notify listeners that the line associated with the holder has been replaced.void
replacePump
(Pump<?> pump) Notify listeners that the specified pump has been replaced.void
Indicate that a pump has started, and fire a start event to registered listeners.void
Indicate that a pump has stopped, and fire a stop event to registered listeners.void
Unlock all pumps associated with the specified lock.Methods inherited from class com.tccc.kos.commons.core.service.AbstractService
getHandle, getHandlePrefix
Methods inherited from class com.tccc.kos.commons.util.ready.ReadyBean
getReady, onBeanReady, onDependenciesReady
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tccc.kos.commons.core.context.CtxEventListener
onCtxAutowiringCompleted, onCtxDestroyed, onCtxPhaseCompleted
Methods inherited from interface com.tccc.kos.commons.core.service.handle.HandleAware
addHandleChild, getName, getPath
Methods inherited from interface com.tccc.kos.commons.util.ready.Ready
isReady, setReady
Methods inherited from interface com.tccc.kos.commons.util.ready.ReadyListener
onDependenciesGroupReady
-
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 aPumpIntent
object. 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
-
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
-
lockExists
Return true if the specified lock exists.- Parameters:
lock
- the lock object to release
-
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
-
stop
Indicate that a pump has stopped, and fire a stop event to registered listeners.- Parameters:
pump
- the pump that stopped
-
replacePump
Notify listeners that the specified pump has been replaced.- Parameters:
pump
- the pump that has been replaced
-
replaceLine
Notify listeners that the line associated with the holder has been replaced.- Parameters:
holder
- the holder with the line that was replaced
-