@InterfaceAudience.Private public class ExecutorService extends Object
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)
.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ExecutorService.Executor
Executor instance.
|
class |
ExecutorService.ExecutorConfig
Configuration wrapper for
ExecutorService.Executor . |
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.
|
(package private) static class |
ExecutorService.TrackingThreadPoolExecutor
A subclass of ThreadPoolExecutor that keeps track of the Runnables that are executing at any
given point in time.
|
Modifier and Type | Field and Description |
---|---|
private org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListeningScheduledExecutorService |
delayedSubmitTimer |
private ConcurrentHashMap<String,ExecutorService.Executor> |
executorMap |
private static org.slf4j.Logger |
LOG |
private String |
servername |
Constructor and Description |
---|
ExecutorService(String servername)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
delayedSubmit(EventHandler eh,
long delay,
TimeUnit unit) |
Map<String,ExecutorService.ExecutorStatus> |
getAllExecutorStatuses() |
(package private) ExecutorService.Executor |
getExecutor(ExecutorType type) |
(package private) ExecutorService.Executor |
getExecutor(String name) |
ThreadPoolExecutor |
getExecutorLazily(ExecutorService.ExecutorConfig config)
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 using
startExecutorService(ExecutorConfig) |
ThreadPoolExecutor |
getExecutorThreadPool(ExecutorType type) |
(package private) boolean |
isExecutorServiceRunning(String name) |
void |
shutdown() |
void |
startExecutorService(ExecutorService.ExecutorConfig config)
Start an executor service with a given name.
|
void |
submit(EventHandler eh) |
private static final org.slf4j.Logger LOG
private final ConcurrentHashMap<String,ExecutorService.Executor> executorMap
private final String servername
private final org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListeningScheduledExecutorService delayedSubmitTimer
public ExecutorService(String servername)
servername
- Name of the hosting server.public void startExecutorService(ExecutorService.ExecutorConfig config)
config
- Configuration to use for the executor.boolean isExecutorServiceRunning(String name)
public void shutdown()
ExecutorService.Executor getExecutor(ExecutorType type)
ExecutorService.Executor getExecutor(String name)
public ThreadPoolExecutor getExecutorThreadPool(ExecutorType type)
public ThreadPoolExecutor getExecutorLazily(ExecutorService.ExecutorConfig config)
startExecutorService(ExecutorConfig)
public void submit(EventHandler eh)
public void delayedSubmit(EventHandler eh, long delay, TimeUnit unit)
public Map<String,ExecutorService.ExecutorStatus> getAllExecutorStatuses()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.