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
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    lock(NozzlePipeline pipeline, Pump<?> pump, Object lock)
    Lock a pump relative to a pipeline referencing the specified lock object.
    boolean
    Return true if the specified lock exists.
    void
    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
    start(Pump<?> pump)
    Indicate that a pump has started, and fire a start event to registered listeners.
    void
    stop(Pump<?> pump)
    Indicate that a pump has stopped, and fire a stop event to registered listeners.
    void
    unlock(Object lock)
    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

  • Method Details

    • lock

      public void lock(NozzlePipeline pipeline, Pump<?> pump, Object 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 a PumpIntent 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 event
      pump - the pump to lock
      lock - the lock object
    • unlock

      public void unlock(Object lock)
      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

      public boolean lockExists(Object lock)
      Return true if the specified lock exists.
      Parameters:
      lock - the lock object to release
    • start

      public void start(Pump<?> pump)
      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

      public void stop(Pump<?> pump)
      Indicate that a pump has stopped, and fire a stop event to registered listeners.
      Parameters:
      pump - the pump that stopped
    • replacePump

      public void replacePump(Pump<?> pump)
      Notify listeners that the specified pump has been replaced.
      Parameters:
      pump - the pump that has been replaced
    • replaceLine

      public void replaceLine(Holder holder)
      Notify listeners that the line associated with the holder has been replaced.
      Parameters:
      holder - the holder with the line that was replaced