public abstract class AbstractAsyncServiceScheduler extends Object
processRequestFromRequestQueue(MessageRequest)
to dictate how
asynchronous requests should be handled.Modifier and Type | Class and Description |
---|---|
static class |
AbstractAsyncServiceScheduler.AsyncServiceSchedulerStatus
Possible statuses of the AsyncServiceScheduler.
|
Constructor and Description |
---|
AbstractAsyncServiceScheduler(AsyncServiceSchedulerResultsReceiver resultsReceiver)
Constructs new AbstractAsyncServiceScheduler.
|
AbstractAsyncServiceScheduler(AsyncServiceSchedulerResultsReceiver resultsReceiver,
int requestQueueCapacity)
Constructs new AbstractAsyncServiceScheduler.
|
Modifier and Type | Method and Description |
---|---|
protected AsyncServiceSchedulerResultsReceiver |
getResultsReceiver() |
AbstractAsyncServiceScheduler.AsyncServiceSchedulerStatus |
getStatus() |
boolean |
pause()
Pauses the Async Service Scheduler.
|
protected abstract void |
processRequestFromRequestQueue(MessageRequest request)
Processes a request that was pulled from the request queue by the
requestQueueConsumerThread . |
boolean |
resume()
Resumes the Async Service Scheduler.
|
boolean |
shutdown()
Shuts down Async Service Scheduler, cleaning up resources.
|
boolean |
startUp()
Starts up the asynchronous service scheduler, so that it is ready to consume and process requests.
|
MessageStatusCode |
submitRequest(MessageRequest request)
Submits a request to the request queue.
|
public AbstractAsyncServiceScheduler(AsyncServiceSchedulerResultsReceiver resultsReceiver)
resultsReceiver
- subscriber to send responses to via
AsyncServiceSchedulerResultsReceiver.reportServiceSchedulerResponse(MessageResponse)
.public AbstractAsyncServiceScheduler(AsyncServiceSchedulerResultsReceiver resultsReceiver, int requestQueueCapacity)
resultsReceiver
- subscriber to send responses to viarequestQueueCapacity
- the maximum number of requests that can be in the request queue
AsyncServiceSchedulerResultsReceiver.reportServiceSchedulerResponse(MessageResponse)
.IllegalArgumentException
- if request queue capacity is less than onepublic boolean startUp()
public MessageStatusCode submitRequest(MessageRequest request)
request
- request to add to the request queue.MessageStatusCode.SCHEDULED
on success;
MessageStatusCode.REQUEST_QUEUE_FULL
if request queue was full; or
MessageStatusCode.ILLEGAL_STATE_ERROR
if scheduler is not RUNNINGprotected abstract void processRequestFromRequestQueue(MessageRequest request)
requestQueueConsumerThread
.request
- request to be processedpublic boolean shutdown()
public AbstractAsyncServiceScheduler.AsyncServiceSchedulerStatus getStatus()
protected AsyncServiceSchedulerResultsReceiver getResultsReceiver()
public boolean pause()
public boolean resume()