@ComponentProfile(summary="Delay processing", tag="service") public class WaitService extends ServiceImp
Implementation of Service
for testing which sleeps for a configurable period.
In the adapter configuration file this class is aliased as wait-service which is the preferred alternative to the fully qualified classname when building your configuration.
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
WaitService()
Creates a new instance.
|
WaitService(java.lang.String uniqueId) |
WaitService(TimeInterval wait) |
WaitService(TimeInterval wait,
java.lang.Boolean randomize) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
void |
doService(AdaptrisMessage msg)
Waits for the configured number of milliseconds.
|
java.lang.Boolean |
getExceptionOnInterrupt() |
java.lang.Boolean |
getRandomize() |
TimeInterval |
getWaitInterval() |
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
protected boolean |
randomizeWait() |
void |
setExceptionOnInterrupt(java.lang.Boolean b)
Whether or not to throw an exception if an
InterruptedException happens. |
void |
setRandomize(java.lang.Boolean b)
Set to true to randomize the wait time between 0 and the value specified by
setWaitInterval(TimeInterval) |
void |
setWaitInterval(TimeInterval interval)
Set how long to wait for.
|
protected long |
waitMs() |
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
public WaitService()
Creates a new instance.
public WaitService(TimeInterval wait)
public WaitService(TimeInterval wait, java.lang.Boolean randomize)
public WaitService(java.lang.String uniqueId)
public void doService(AdaptrisMessage msg) throws ServiceException
Waits for the configured number of milliseconds.
msg
- the message to apply service toServiceException
- wrapping any underlying Exception
sprotected void initService()
initService
in class ServiceImp
protected void closeService()
closeService
in class ServiceImp
protected long waitMs()
public TimeInterval getWaitInterval()
public void setWaitInterval(TimeInterval interval)
interval
- if not specified then the default is 20 seconds.public void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
public java.lang.Boolean getRandomize()
public void setRandomize(java.lang.Boolean b)
setWaitInterval(TimeInterval)
b
- default null (false)protected boolean randomizeWait()
public java.lang.Boolean getExceptionOnInterrupt()
public void setExceptionOnInterrupt(java.lang.Boolean b)
InterruptedException
happens.b
- the exceptionOnInterupt to set