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
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(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
Modifier and TypeClassDescription(package private) static class
Executor instance.class
Configuration wrapper forExecutorService.Executor
.static class
A snapshot of the status of a particular executor.static class
The status of a particular event that is in the middle of being handled by an executor.(package private) static class
A subclass of ThreadPoolExecutor that keeps track of the Runnables that are executing at any given point in time. -
Field Summary
Modifier and TypeFieldDescriptionprivate final org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListeningScheduledExecutorService
private final ConcurrentMap<String,
ExecutorService.Executor> private static final org.slf4j.Logger
private final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
delayedSubmit
(EventHandler eh, long delay, TimeUnit unit) (package private) ExecutorService.Executor
getExecutor
(String name) (package private) ExecutorService.Executor
getExecutor
(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) boolean
void
shutdown()
void
Start an executor service with a given name.void
submit
(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
-