public class CopyMonitor extends java.lang.Object implements java.util.concurrent.Callable<CopyResult>, TransferMonitor
isDone()
and getFuture()
Modifier and Type | Field and Description |
---|---|
private java.util.List<java.util.concurrent.Future<PartETag>> |
futures |
private boolean |
isCopyDone |
private CopyCallable |
multipartCopyCallable
Reference to the CopyCallable that is used for initiating copy requests.
|
private java.util.concurrent.Future<CopyResult> |
nextFuture |
private CopyObjectRequest |
origReq
A reference to the original copy request received.
|
private int |
pollInterval |
private ProgressListenerChain |
progressListenerChain |
private AmazonS3 |
s3
Reference to the Amazon S3 client object that is used to initiate the copy
or copy part request.
|
private java.util.concurrent.ExecutorService |
threadPool
Thread pool used during multi-part copy is performed.
|
private java.util.concurrent.ScheduledExecutorService |
timedThreadPool
Thread pool used for scheduling the monitor to check if the copy
operation is completed.
|
private CopyImpl |
transfer |
private java.lang.String |
uploadId |
Modifier | Constructor and Description |
---|---|
private |
CopyMonitor(TransferManager manager,
CopyImpl transfer,
java.util.concurrent.ExecutorService threadPool,
CopyCallable multipartCopyCallable,
CopyObjectRequest copyObjectRequest,
ProgressListenerChain progressListenerChain) |
Modifier and Type | Method and Description |
---|---|
CopyResult |
call() |
private java.util.List<PartETag> |
collectPartETags() |
private CopyResult |
completeMultipartUpload()
Completes the multipart upload and returns the result.
|
private CopyResult |
copy()
Initiates the copy operation and checks on the result.
|
private void |
copyComplete() |
static CopyMonitor |
create(TransferManager manager,
CopyImpl transfer,
java.util.concurrent.ExecutorService threadPool,
CopyCallable multipartCopyCallable,
CopyObjectRequest copyObjectRequest,
ProgressListenerChain progressListenerChain)
Constructs a new watcher for copy operation, and then immediately submits
it to the thread pool.
|
java.util.concurrent.Future<CopyResult> |
getFuture()
Returns a Future to wait on.
|
boolean |
isDone()
Returns whether the transfer is completed.
|
private void |
markAllDone() |
private CopyResult |
poll()
Polls for a result from a multi-part copy operation and either returns it
if complete, or reschedules to poll again later if not.
|
private void |
reschedule() |
private void |
setNextFuture(java.util.concurrent.Future<CopyResult> nextFuture) |
void |
setTimedThreadPool(java.util.concurrent.ScheduledExecutorService timedThreadPool) |
private final AmazonS3 s3
private final java.util.concurrent.ExecutorService threadPool
private final CopyObjectRequest origReq
private java.util.concurrent.ScheduledExecutorService timedThreadPool
private final CopyCallable multipartCopyCallable
private final CopyImpl transfer
private final ProgressListenerChain progressListenerChain
private java.lang.String uploadId
private final java.util.List<java.util.concurrent.Future<PartETag>> futures
private boolean isCopyDone
private java.util.concurrent.Future<CopyResult> nextFuture
private int pollInterval
private CopyMonitor(TransferManager manager, CopyImpl transfer, java.util.concurrent.ExecutorService threadPool, CopyCallable multipartCopyCallable, CopyObjectRequest copyObjectRequest, ProgressListenerChain progressListenerChain)
public java.util.concurrent.Future<CopyResult> getFuture()
TransferMonitor
getFuture
in interface TransferMonitor
private void setNextFuture(java.util.concurrent.Future<CopyResult> nextFuture)
public boolean isDone()
TransferMonitor
isDone
in interface TransferMonitor
private void markAllDone()
public static CopyMonitor create(TransferManager manager, CopyImpl transfer, java.util.concurrent.ExecutorService threadPool, CopyCallable multipartCopyCallable, CopyObjectRequest copyObjectRequest, ProgressListenerChain progressListenerChain)
manager
- The TransferManager
that owns this copy request.threadPool
- The ExecutorService
to which we should submit new
tasks.multipartCopyCallable
- The callable responsible for processing the copy
asynchronouslycopyObjectRequest
- The original CopyObject requestpublic CopyResult call() throws java.lang.Exception
call
in interface java.util.concurrent.Callable<CopyResult>
java.lang.Exception
public void setTimedThreadPool(java.util.concurrent.ScheduledExecutorService timedThreadPool)
private CopyResult poll() throws java.lang.InterruptedException
java.lang.InterruptedException
private CopyResult copy() throws java.lang.Exception, java.lang.InterruptedException
java.lang.Exception
java.lang.InterruptedException
private void copyComplete()
private void reschedule()
private CopyResult completeMultipartUpload()
private java.util.List<PartETag> collectPartETags()