public class SlowServiceRunner extends Object
Constructor and Description |
---|
SlowServiceRunner(Runner resultRunner,
int maxPoolSize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
enqueueTask(Callable<Object> task,
ArgRunnable resultHandler)
Enqueue a task to be executed via the slow path.
|
public SlowServiceRunner(Runner resultRunner, int maxPoolSize)
resultRunner
- Run queue in which result handlers will be runmaxPoolSize
- Maximum number of threads allowed in the thread poolpublic void enqueueTask(Callable<Object> task, ArgRunnable resultHandler)
Tasks should return a result object that will be passed to the given result handler for execution in the main server run queue. It is permissible for a task result to be null. However, if a task throws an exception, this will be given to the handler as the result, so if the normal task result is an exception type, it is up to the programmer of the task and the result handler to take measures to sort things out appropriately.
task
- Callable that executes the task. This will be executed in
a separate thread.resultHandler
- Thunk that will be invoked with the result
returned by the task. This will be executed on the main run queue.Copyright © 2017. All rights reserved.