|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hbase.executor.ExecutorService
@InterfaceAudience.Private public class ExecutorService
This is a generic executor service. This component abstracts a
threadpool, a queue to which EventTypes can be submitted,
and a Runnable that handles the object that is added to the queue.
In order to create a new service, create an instance of this class and
then do: instance.startExecutorService("myService");. When done
call shutdown().
In order to use the service created above, call
submit(EventHandler). Register pre- and post- processing listeners
by registering your implementation of EventHandler.EventHandlerListener
with registerListener(EventType, EventHandler.EventHandlerListener). Be sure
to deregister your listener when done via unregisterListener(EventType).
| Nested Class Summary | |
|---|---|
static class |
ExecutorService.ExecutorStatus
A snapshot of the status of a particular executor. |
static class |
ExecutorService.RunningEventStatus
The status of a particular event that is in the middle of being handled by an executor. |
| Constructor Summary | |
|---|---|
ExecutorService(String servername)
Default constructor. |
|
| Method Summary | |
|---|---|
Map<String,ExecutorService.ExecutorStatus> |
getAllExecutorStatuses()
|
ThreadPoolExecutor |
getExecutorThreadPool(ExecutorType type)
|
void |
registerListener(EventType type,
EventHandler.EventHandlerListener listener)
Subscribe to updates before and after processing instances of EventType. |
void |
shutdown()
|
void |
startExecutorService(ExecutorType type,
int maxThreads)
|
void |
submit(EventHandler eh)
|
EventHandler.EventHandlerListener |
unregisterListener(EventType type)
Stop receiving updates before and after processing instances of EventType |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ExecutorService(String servername)
servername - Name of the hosting server.| Method Detail |
|---|
public void shutdown()
public ThreadPoolExecutor getExecutorThreadPool(ExecutorType type)
public void startExecutorService(ExecutorType type,
int maxThreads)
public void submit(EventHandler eh)
public void registerListener(EventType type,
EventHandler.EventHandlerListener listener)
EventType. Currently only one listener per
event type.
type - Type of event we're registering listener forlistener - The listener to run.public EventHandler.EventHandlerListener unregisterListener(EventType type)
EventType
type - Type of event we're registering listener for
public Map<String,ExecutorService.ExecutorStatus> getAllExecutorStatuses()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||