|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.executor.ExecutorService
public class ExecutorService
This is a generic executor service. This component abstracts a
threadpool, a queue to which 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)
.
Nested Class Summary | |
---|---|
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. |
Constructor Summary | |
---|---|
ExecutorService(String servername)
Default constructor. |
Method Summary | |
---|---|
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 |
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 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 for
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |