static class RegionServerSnapshotManager.SnapshotSubprocedurePool extends Object
ExecutorService
.
It uses a ExecutorCompletionService
which provides queuing of
completed tasks which lets us efficiently cancel pending tasks upon the earliest operation
failures.
HBase's ExecutorService (different from ExecutorService
) isn't
really built for coordinated tasks where multiple threads as part of one larger task. In
RS's the HBase Executor services are only used for open and close and not other threadpooled
operations such as compactions and replication sinks.Modifier and Type | Field and Description |
---|---|
private Abortable |
abortable |
private ThreadPoolExecutor |
executor |
private List<Future<Void>> |
futures |
private String |
name |
private boolean |
stopped |
private ExecutorCompletionService<Void> |
taskPool |
Constructor and Description |
---|
SnapshotSubprocedurePool(String name,
org.apache.hadoop.conf.Configuration conf,
Abortable abortable) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
cancelTasks()
This attempts to cancel out all pending and in progress tasks (interruptions issues)
|
(package private) boolean |
hasTasks() |
(package private) void |
stop()
Abruptly shutdown the thread pool.
|
(package private) void |
submitTask(Callable<Void> task)
Submit a task to the pool.
|
(package private) boolean |
waitForOutstandingTasks()
Wait for all of the currently outstanding tasks submitted via
submitTask(Callable) . |
private final ExecutorCompletionService<Void> taskPool
private final ThreadPoolExecutor executor
private volatile boolean stopped
SnapshotSubprocedurePool(String name, org.apache.hadoop.conf.Configuration conf, Abortable abortable)
boolean hasTasks()
void submitTask(Callable<Void> task)
waitForOutstandingTasks()
. This
version does not support issuing tasks from multiple concurrent table snapshots requests.boolean waitForOutstandingTasks() throws ForeignException, InterruptedException
submitTask(Callable)
.
This *must* be called after all tasks are submitted via submitTask.InterruptedException
SnapshotCreationException
- if the snapshot failed while we were waitingForeignException
void cancelTasks() throws InterruptedException
InterruptedException
void stop()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.