public class UploadMonitor extends java.lang.Object implements java.util.concurrent.Callable<UploadResult>, TransferMonitor
isDone()
and
getFuture()
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.Future<UploadResult> |
future |
private java.util.List<java.util.concurrent.Future<PartETag>> |
futures |
private boolean |
isUploadDone |
private ProgressListenerChain |
listener |
private UploadCallable |
multipartUploadCallable |
private PutObjectRequest |
origReq |
private AmazonS3 |
s3 |
private java.util.concurrent.ExecutorService |
threadPool |
private UploadImpl |
transfer |
Modifier | Constructor and Description |
---|---|
private |
UploadMonitor(TransferManager manager,
UploadImpl transfer,
java.util.concurrent.ExecutorService threadPool,
UploadCallable multipartUploadCallable,
PutObjectRequest putObjectRequest,
ProgressListenerChain progressListenerChain) |
Modifier and Type | Method and Description |
---|---|
UploadResult |
call() |
private void |
cancelFuture() |
private void |
cancelFutures()
Cancels the inflight transfers if they are not completed.
|
static UploadMonitor |
create(TransferManager manager,
UploadImpl transfer,
java.util.concurrent.ExecutorService threadPool,
UploadCallable multipartUploadCallable,
PutObjectRequest putObjectRequest,
ProgressListenerChain progressListenerChain)
Constructs a new upload watcher and then immediately submits it to
the thread pool.
|
java.util.concurrent.Future<UploadResult> |
getFuture()
Returns a Future to wait on.
|
boolean |
isDone()
Returns whether the transfer is completed.
|
private void |
markAllDone() |
(package private) PauseResult<PersistableUpload> |
pause(boolean forceCancel)
Cancels the futures in the following cases - If the user has requested
for forcefully aborting the transfers.
|
(package private) void |
performAbort()
Cancels all the futures associated with this upload operation.
|
private void |
setFuture(java.util.concurrent.Future<UploadResult> future) |
(package private) void |
uploadComplete() |
private final AmazonS3 s3
private final PutObjectRequest origReq
private final ProgressListenerChain listener
private final UploadCallable multipartUploadCallable
private final UploadImpl transfer
private final java.util.concurrent.ExecutorService threadPool
private final java.util.List<java.util.concurrent.Future<PartETag>> futures
private boolean isUploadDone
private java.util.concurrent.Future<UploadResult> future
private UploadMonitor(TransferManager manager, UploadImpl transfer, java.util.concurrent.ExecutorService threadPool, UploadCallable multipartUploadCallable, PutObjectRequest putObjectRequest, ProgressListenerChain progressListenerChain)
public java.util.concurrent.Future<UploadResult> getFuture()
TransferMonitor
getFuture
in interface TransferMonitor
private void setFuture(java.util.concurrent.Future<UploadResult> future)
private void cancelFuture()
public boolean isDone()
TransferMonitor
isDone
in interface TransferMonitor
private void markAllDone()
public static UploadMonitor create(TransferManager manager, UploadImpl transfer, java.util.concurrent.ExecutorService threadPool, UploadCallable multipartUploadCallable, PutObjectRequest putObjectRequest, ProgressListenerChain progressListenerChain)
manager
- The TransferManager
that owns this upload.transfer
- The transfer being processed.threadPool
- The ExecutorService
to which we should submit new
tasks.multipartUploadCallable
- The callable responsible for processing the upload
asynchronouslyputObjectRequest
- The original putObject requestprogressListenerChain
- A chain of listeners that wish to be notified of upload
progresspublic UploadResult call() throws java.lang.Exception
call
in interface java.util.concurrent.Callable<UploadResult>
java.lang.Exception
void uploadComplete()
PauseResult<PersistableUpload> pause(boolean forceCancel)
private void cancelFutures()
void performAbort()