public abstract class ProcessorBase<T> extends HandlerBase
Modifier and Type | Field and Description |
---|---|
static int |
STATE_FORCED_SHUTDOWN |
static int |
STATE_NOT_RUNNING |
static int |
STATE_RUNNING |
protected Queue<T> |
tasks |
Constructor and Description |
---|
ProcessorBase(Executor parent) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
doTask(T task) |
boolean |
flush(long timeout,
TimeUnit unit)
WARNING: This will only flush when all the activity is suspended.
|
boolean |
isFlushed() |
int |
remaining()
Returns the remaining items to be processed.
|
void |
shutdown()
It will shutdown and wait 30 seconds for timeout.
|
void |
shutdown(long timeout,
TimeUnit unit) |
int |
shutdownNow(Consumer<? super T> onPendingItem,
int timeout,
TimeUnit unit)
It will shutdown the executor however it will not wait for finishing tasks
|
int |
status() |
protected void |
task(T command) |
enter, inHandler, leave
public static final int STATE_NOT_RUNNING
public static final int STATE_RUNNING
public static final int STATE_FORCED_SHUTDOWN
public ProcessorBase(Executor parent)
public void shutdown()
public void shutdown(long timeout, TimeUnit unit)
public int shutdownNow(Consumer<? super T> onPendingItem, int timeout, TimeUnit unit)
protected abstract void doTask(T task)
public final boolean isFlushed()
public final boolean flush(long timeout, TimeUnit unit)
protected void task(T command)
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.
public final int status()
Copyright © 2021 JBoss by Red Hat. All rights reserved.