Class PumpEventService

java.lang.Object
com.kosdev.kos.ext.dispense.service.pumpevent.PumpEventService

public final class PumpEventService extends Object
Service that distributes pump lifecycle events.
Since:
1
Version:
1
  • Field Details

  • Method Details

    • lock

      public boolean 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
      Returns:
      true if the pump was successfully locked
      Since:
      1
    • unlock

      public void unlock(NozzlePipeline pipeline, 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.

      Added pipeline argument in api version 10.

      Parameters:
      pipeline - the pipeline performing the unlock
      lock - the lock object to release
      Since:
      10
    • lockExists

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

      public boolean isRunning(Pump<?> pump)
      Return true if the specified pumps is in a running state
      Parameters:
      pump - the pump to check
      Since:
      1
    • start

      public void start(NozzlePipeline pipeline, 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.

      Added pipeline argument in api version 10.

      Parameters:
      pipeline - the pipeline performing the start
      pump - the pump that started
      Since:
      10
    • stop

      public void stop(NozzlePipeline pipeline, Pump<?> pump)
      Indicate that a pump has stopped, and fire a stop event to registered listeners.

      Added pipeline argument in api version 10.

      Parameters:
      pump - the pump that stopped
      Since:
      10
    • replacePump

      public void replacePump(Pump<?> pump)
      Notify listeners that the specified pump has been replaced.
      Parameters:
      pump - the pump that has been replaced
      Since:
      1
    • 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
      Since:
      1