public abstract class QueueWorker<E> extends Worker
Worker.WorkContext
ILifecycle.DeferrableActivation
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_POLL_MILLIS |
DEFAULT_ERROR_HANDLER, DEFAULT_TIMEOUT
Constructor and Description |
---|
QueueWorker() |
Modifier and Type | Method and Description |
---|---|
boolean |
addWork(E element) |
void |
clearQueue() |
protected BlockingQueue<E> |
createQueue() |
protected void |
doDeactivate() |
protected boolean |
doRemainingWorkBeforeDeactivate() |
long |
getPollMillis() |
protected void |
noWork(Worker.WorkContext context) |
void |
setPollMillis(long pollMillis) |
protected void |
work(Worker.WorkContext context) |
protected abstract void |
work(Worker.WorkContext context,
E element) |
doActivate, getActivationTimeout, getDeactivationTimeout, getGlobalErrorHandler, getThreadName, getWorkerThread, handleError, isDaemon, setActivationTimeout, setDaemon, setDeactivationTimeout, setGlobalErrorHandler
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doAfterActivate, doBeforeActivate, doBeforeDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toString
addListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addListener, getListeners, hasListeners, removeListener
public static final int DEFAULT_POLL_MILLIS
public long getPollMillis()
public void setPollMillis(long pollMillis)
public void clearQueue()
public boolean addWork(E element)
protected void work(Worker.WorkContext context) throws Exception
protected abstract void work(Worker.WorkContext context, E element)
protected void noWork(Worker.WorkContext context)
protected BlockingQueue<E> createQueue()
protected boolean doRemainingWorkBeforeDeactivate()
protected void doDeactivate() throws Exception
doDeactivate
in class Worker
Exception
Copyright (c) 2011-2015 Eike Stepper (Berlin, Germany) and others.