public abstract class ScheduledTaskPoller extends PollerImp
PollerImp.Callback
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.ScheduledExecutorService |
executor |
protected java.util.concurrent.ScheduledFuture |
pollerTask |
Constructor and Description |
---|
ScheduledTaskPoller() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component.
|
TimeInterval |
getShutdownWaitTime() |
void |
init()
Initialises the component.
|
protected abstract void |
scheduleTask() |
void |
setShutdownWaitTime(TimeInterval interval)
Set the shutdown wait timeout for the pool.
|
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
attemptLock, processMessages, registerConsumer, releaseLock, retrieveConsumer, withPollerCallback
protected transient java.util.concurrent.ScheduledExecutorService executor
protected transient java.util.concurrent.ScheduledFuture pollerTask
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
CoreException
- wrapping any underlying Exception
spublic void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
CoreException
- wrapping any underlying Exception
sprotected abstract void scheduleTask()
public void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
public void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException
may
cause unintended consequences
public TimeInterval getShutdownWaitTime()
public void setShutdownWaitTime(TimeInterval interval)
When stop()
is invoked, this causes a emptying and shutdown of the pool. The specified value is the amount of time
to wait for a clean shutdown. If this timeout is exceeded then a forced shutdown ensues, which may mean messages are in an
inconsistent state.
interval
- the shutdown time (default is 60 seconds)stop()