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 Summary
Fields Modifier and Type Field Description static intSTATE_FORCED_SHUTDOWNstatic intSTATE_NOT_RUNNINGstatic intSTATE_RUNNINGprotected java.util.Queue<T>tasks
-
Constructor Summary
Constructors Constructor Description ProcessorBase(java.util.concurrent.Executor parent)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voiddoTask(T task)booleanflush(long timeout, java.util.concurrent.TimeUnit unit)WARNING: This will only flush when all the activity is suspended.booleanisFlushed()intremaining()Returns the remaining items to be processed.voidshutdown()It will shutdown and wait 30 seconds for timeout.voidshutdown(long timeout, java.util.concurrent.TimeUnit unit)intshutdownNow(java.util.function.Consumer<? super T> onPendingItem, int timeout, java.util.concurrent.TimeUnit unit)It will shutdown the executor however it will not wait for finishing tasksintstatus()protected voidtask(T command)-
Methods inherited from class org.apache.activemq.artemis.utils.actors.HandlerBase
enter, inHandler, leave
-
-
-
-
Field Detail
-
STATE_NOT_RUNNING
public static final int STATE_NOT_RUNNING
- See Also:
- Constant Field Values
-
STATE_RUNNING
public static final int STATE_RUNNING
- See Also:
- Constant Field Values
-
STATE_FORCED_SHUTDOWN
public static final int STATE_FORCED_SHUTDOWN
- See Also:
- Constant Field Values
-
tasks
protected final java.util.Queue<T> tasks
-
-
Method Detail
-
shutdown
public void shutdown()
It will shutdown and wait 30 seconds for timeout.
-
shutdown
public void shutdown(long timeout, java.util.concurrent.TimeUnit unit)
-
shutdownNow
public int shutdownNow(java.util.function.Consumer<? super T> onPendingItem, int timeout, java.util.concurrent.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, java.util.concurrent.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()
Returns the remaining items to be processed.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 itsO(n)cost.
-
status
public final int status()
-
-