Package org.apache.hadoop.hbase.executor
Class ExecutorService
java.lang.Object
org.apache.hadoop.hbase.executor.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(executorConfig);. ExecutorService.ExecutorConfig wraps the
configuration needed by this service. When done call shutdown().
In order to use the service created above, call submit(EventHandler).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classExecutor instance.classConfiguration wrapper forExecutorService.Executor.static classA snapshot of the status of a particular executor.static classThe status of a particular event that is in the middle of being handled by an executor.(package private) static classA subclass of ThreadPoolExecutor that keeps track of the Runnables that are executing at any given point in time. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListeningScheduledExecutorServiceprivate final ConcurrentMap<String,ExecutorService.Executor> private static final org.slf4j.Loggerprivate final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddelayedSubmit(EventHandler eh, long delay, TimeUnit unit) (package private) ExecutorService.ExecutorgetExecutor(String name) (package private) ExecutorService.ExecutorgetExecutor(ExecutorType type) Initialize the executor lazily, Note if an executor need to be initialized lazily, then all paths should use this method to get the executor, should not start executor by usingstartExecutorService(ExecutorConfig)(package private) booleanvoidshutdown()voidStart an executor service with a given name.voidsubmit(EventHandler eh)
-
Field Details
-
LOG
-
executorMap
-
servername
-
delayedSubmitTimer
private final org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListeningScheduledExecutorService delayedSubmitTimer
-
-
Constructor Details
-
ExecutorService
Default constructor.- Parameters:
servername- Name of the hosting server.
-
-
Method Details
-
startExecutorService
Start an executor service with a given name. If there was a service already started with the same name, this throws a RuntimeException.- Parameters:
config- Configuration to use for the executor.
-
isExecutorServiceRunning
-
shutdown
-
getExecutor
-
getExecutor
-
getExecutorThreadPool
-
getExecutorLazily
Initialize the executor lazily, Note if an executor need to be initialized lazily, then all paths should use this method to get the executor, should not start executor by usingstartExecutorService(ExecutorConfig) -
submit
-
delayedSubmit
-
getAllExecutorStatuses
-