private abstract class S3ServiceMulti.ThreadGroupManager
extends java.lang.Object
The manager starts all the threads, monitors their progress and stops threads when they are
cancelled or an error occurs - all the while firing the appropriate ServiceEvent event
notifications.
| Modifier and Type | Class and Description |
|---|---|
private class |
S3ServiceMulti.ThreadGroupManager.ResultsTuple |
| Modifier and Type | Field and Description |
|---|---|
private boolean[] |
alreadyFired
set of flags indicating which threads have already had In Progress events fired on
their behalf.
|
private boolean |
ignoreExceptions |
private long |
lastProgressEventFiredTime |
private org.apache.commons.logging.Log |
log |
private int |
maxThreadCount |
private S3ServiceMulti.AbstractRunnable[] |
runnables
the set of runnable objects to execute.
|
private boolean[] |
started
set of flags indicating which runnable items have been started
|
private java.lang.Thread[] |
threads
Thread objects that are currently running, where the index corresponds to the
runnables index.
|
private ThreadWatcher |
threadWatcher |
| Constructor and Description |
|---|
ThreadGroupManager(S3ServiceMulti.AbstractRunnable[] runnables,
ThreadWatcher threadWatcher,
Jets3tProperties jets3tProperties,
boolean isAdminTask) |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
fireCancelEvent() |
abstract void |
fireCompletedEvent() |
abstract void |
fireErrorEvent(java.lang.Throwable t) |
abstract void |
fireIgnoredErrorsEvent(ThreadWatcher threadWatcher,
java.lang.Throwable[] ignoredErrors) |
abstract void |
fireProgressEvent(ThreadWatcher threadWatcher,
java.util.List completedResults) |
abstract void |
fireStartEvent(ThreadWatcher threadWatcher) |
private void |
forceInterruptAllRunnables()
Invokes the
S3ServiceMulti.AbstractRunnable.forceInterrupt() on all threads being managed. |
private S3ServiceMulti.ThreadGroupManager.ResultsTuple |
getNewlyCompletedResults()
Determine which threads, if any, have finished since the last time an In Progress event
was fired.
|
private int |
getPendingThreadCount() |
void |
run()
Runs and manages all the threads involved in an S3 multi-operation.
|
private void |
startPendingThreads()
Starts pending threads such that the total of running threads never exceeds the
maximum count set in the jets3t property s3service.max-thread-count.
|
private final org.apache.commons.logging.Log log
private int maxThreadCount
private S3ServiceMulti.AbstractRunnable[] runnables
private java.lang.Thread[] threads
private boolean ignoreExceptions
private boolean[] started
private boolean[] alreadyFired
private ThreadWatcher threadWatcher
private long lastProgressEventFiredTime
public ThreadGroupManager(S3ServiceMulti.AbstractRunnable[] runnables, ThreadWatcher threadWatcher, Jets3tProperties jets3tProperties, boolean isAdminTask)
private S3ServiceMulti.ThreadGroupManager.ResultsTuple getNewlyCompletedResults() throws java.lang.Throwable
java.lang.Throwableprivate void startPendingThreads()
throws java.lang.Throwable
java.lang.Throwableprivate int getPendingThreadCount()
private void forceInterruptAllRunnables()
S3ServiceMulti.AbstractRunnable.forceInterrupt() on all threads being managed.public void run()
public abstract void fireStartEvent(ThreadWatcher threadWatcher)
public abstract void fireProgressEvent(ThreadWatcher threadWatcher, java.util.List completedResults)
public abstract void fireCompletedEvent()
public abstract void fireCancelEvent()
public abstract void fireErrorEvent(java.lang.Throwable t)
public abstract void fireIgnoredErrorsEvent(ThreadWatcher threadWatcher, java.lang.Throwable[] ignoredErrors)