Class ProcessorBase<T>

java.lang.Object
org.apache.activemq.artemis.utils.actors.HandlerBase
org.apache.activemq.artemis.utils.actors.ProcessorBase<T>
Direct Known Subclasses:
Actor, OrderedExecutor, ThresholdActor

public abstract class ProcessorBase<T> extends HandlerBase
  • Field Details

    • STATE_NOT_RUNNING

      public static final int STATE_NOT_RUNNING
      See Also:
    • STATE_RUNNING

      public static final int STATE_RUNNING
      See Also:
    • STATE_FORCED_SHUTDOWN

      public static final int STATE_FORCED_SHUTDOWN
      See Also:
    • tasks

      protected final Queue<T> tasks
    • requestedShutdown

      protected volatile boolean requestedShutdown
  • Constructor Details

    • ProcessorBase

      public ProcessorBase(Executor parent)
  • Method Details

    • shutdown

      public void shutdown()
      It will shutdown and wait 30 seconds for timeout.
    • flush

      public void flush()
    • shutdown

      public void shutdown(long timeout, TimeUnit unit)
    • yield

      public void yield()
    • shutdownNow

      public int shutdownNow(Consumer<? super T> onPendingItem, int timeout, TimeUnit unit)
      It will shutdown the executor however it will not wait for finishing tasks
    • doTask

      protected abstract void doTask(T task)
    • isFlushed

      public final boolean isFlushed()
    • flush

      public final boolean flush(long timeout, TimeUnit unit)
      WARNING: This will only flush when all the activity is suspended. don't expect success on this call if another thread keeps feeding the queue this is only valid on situations where you are not feeding the queue, like in shutdown and failover situations.
    • task

      protected void task(T command)
    • remaining

      public final int remaining()
      This method is safe to be called by different threads and its accuracy is subject to concurrent modifications. It is meant to be used only for test purposes, because of its O(n) cost.
      Returns:
      the remaining items to be processed
    • status

      public final int status()