public class ExecutorService extends Object
EventHandler.EventType
s 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(EventHandler.EventType, EventHandler.EventHandlerListener)
. Be sure
to deregister your listener when done via unregisterListener(EventHandler.EventType)
.
Modifier and Type | Class and Description |
---|---|
static class |
ExecutorService.ExecutorStatus
A snapshot of the status of a particular executor.
|
static class |
ExecutorService.ExecutorType
The following is a list of all executor types, both those that run in the
master and those that run in the regionserver.
|
static class |
ExecutorService.RunningEventStatus
The status of a particular event that is in the middle of being
handled by an executor.
|
Constructor and Description |
---|
ExecutorService(String servername)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
Map<String,ExecutorService.ExecutorStatus> |
getAllExecutorStatuses() |
ExecutorService.ExecutorType |
getExecutorServiceType(EventHandler.EventType type)
Returns the executor service type (the thread pool instance) for the
passed event handler type.
|
void |
registerListener(EventHandler.EventType type,
EventHandler.EventHandlerListener listener)
Subscribe to updates before and after processing instances of
EventHandler.EventType . |
void |
shutdown() |
void |
startExecutorService(ExecutorService.ExecutorType type,
int maxThreads) |
void |
submit(EventHandler eh) |
EventHandler.EventHandlerListener |
unregisterListener(EventHandler.EventType type)
Stop receiving updates before and after processing instances of
EventHandler.EventType |
public ExecutorService(String servername)
servername
- Name of the hosting server.public ExecutorService.ExecutorType getExecutorServiceType(EventHandler.EventType type)
type
- EventHandler type.public void shutdown()
public void startExecutorService(ExecutorService.ExecutorType type, int maxThreads)
public void submit(EventHandler eh)
public void registerListener(EventHandler.EventType type, EventHandler.EventHandlerListener listener)
EventHandler.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(EventHandler.EventType type)
EventHandler.EventType
type
- Type of event we're registering listener forpublic Map<String,ExecutorService.ExecutorStatus> getAllExecutorStatuses()
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.