Class CommandQueueManager

java.lang.Object
com.google.common.util.concurrent.AbstractService
org.yamcs.commanding.CommandQueueManager
All Implemented Interfaces:
com.google.common.util.concurrent.Service, ParameterProcessor, SystemParametersProducer

public class CommandQueueManager extends com.google.common.util.concurrent.AbstractService implements ParameterProcessor, SystemParametersProducer
Implements the management of the control queues for one processor:
  • for each command that is sent, based on the sender it finds the queue where the command should go
  • depending on the queue state the command can be immediately sent, stored in the queue or rejected
  • when the command is immediately sent or rejected, the command queue monitor is not notified
  • if the command has transmissionConstraints with timeout > 0, the command can sit in the queue even if the queue is not on hold
Note: the update of the command monitors is done in the same thread. That means that if the connection to one of the monitors is lost, there may be a delay of a few seconds. As the monitoring clients will be priviledged users most likely connected in the same LAN, I don't consider this to be an issue.
  • Constructor Details

  • Method Details

    • doStart

      public void doStart()
      called at processor startup
      Specified by:
      doStart in class com.google.common.util.concurrent.AbstractService
    • doStop

      public void doStop()
      Specified by:
      doStop in class com.google.common.util.concurrent.AbstractService
    • getQueues

      public List<CommandQueue> getQueues()
    • getQueue

      public CommandQueue getQueue(String name)
    • addCommand

      public CommandQueue addCommand(User user, ActiveCommand activeCommand)
      Called from the CommandingImpl to add a command to the queue.

      First the command is added to the command history. Depending on the status of the queue, the command is rejected by setting the CommandFailed in the command history added to the queue or directly sent using the command releaser.

      Parameters:
      user -
      activeCommand -
      Returns:
      the queue the command was added to
    • addToCommandHistory

      public void addToCommandHistory(Commanding.CommandId commandId, Commanding.CommandHistoryAttribute attribute)
    • getQueue

      public CommandQueue getQueue(User user, PreparedCommand pc)
      Parameters:
      user -
      pc -
      Returns:
      the queue where the command should be placed.
    • rejectCommand

      public PreparedCommand rejectCommand(Commanding.CommandId commandId, String username)
      Called by external clients to remove a command from the queue
      Parameters:
      commandId -
      username - the username rejecting the command
      Returns:
      the command removed from the queeu
    • rejectCommand

      @Deprecated public PreparedCommand rejectCommand(UUID uuid, String username)
      Deprecated.
    • rejectCommand

      public PreparedCommand rejectCommand(String commandId, String username)
    • sendCommand

      public PreparedCommand sendCommand(Commanding.CommandId commandId)
      Called from external client to release a command from the queue
      Parameters:
      commandId - - if to rebuild the command binary from the source
      Returns:
      the prepared command sent
    • sendCommand

      @Deprecated public PreparedCommand sendCommand(UUID uuid)
      Deprecated.
    • sendCommand

      public PreparedCommand sendCommand(String commandId)
    • setQueueState

      public CommandQueue setQueueState(String queueName, Commanding.QueueState newState)
      Called from external clients to change the state of the queue
      Parameters:
      queueName - the queue whose state has to be set
      newState - the new state of the queue
      Returns:
      the queue whose state has been changed or null if no queue by the name exists
    • registerListener

      public void registerListener(CommandQueueListener cqm)
      Called from a queue monitor to register itself in order to be notified when new commands are added/removed from the queue.
      Parameters:
      cqm - the callback which will be called with updates
    • removeListener

      public boolean removeListener(CommandQueueListener cqm)
    • getInstance

      public String getInstance()
    • getChannelName

      public String getChannelName()
    • process

      public void process(ProcessingData tmData)
      Called from PRM when new telemetry data is available
      Specified by:
      process in interface ParameterProcessor
    • getSystemParameters

      public Collection<ParameterValue> getSystemParameters(long time)
      Description copied from interface: SystemParametersProducer
      return the next bunch of parameter values.

      The gentime is the mission time when the parameter collection started. The returning parameters can use this time to allow all parameters in one collection interval to be timestamped with the same time.

      Specified by:
      getSystemParameters in interface SystemParametersProducer