public abstract class AbstractTransfer extends Object implements Transfer
Transfer.TransferState| Modifier and Type | Field and Description |
|---|---|
protected com.amazonaws.event.ProgressListenerChain |
listenerChain
Hook for adding/removing more progress listeners.
|
protected TransferMonitor |
monitor |
protected Transfer.TransferState |
state
The current state of this transfer.
|
protected Collection<TransferStateChangeListener> |
stateChangeListeners
Collection of listeners to be notified for changes to the state of this transfer via setState()
|
| Modifier and Type | Method and Description |
|---|---|
void |
addProgressListener(com.amazonaws.event.ProgressListener listener)
Adds the specified progress listener to the list of listeners
receiving updates about this transfer's progress.
|
void |
addProgressListener(ProgressListener listener)
Deprecated.
Replaced by
addProgressListener(ProgressListener) |
void |
addStateChangeListener(TransferStateChangeListener listener)
Adds the given state change listener to the collection of listeners.
|
protected void |
fireProgressEvent(com.amazonaws.event.ProgressEventType eventType) |
String |
getDescription()
Returns a human-readable description of this transfer.
|
TransferMonitor |
getMonitor() |
TransferProgress |
getProgress()
Returns progress information about this transfer.
|
Transfer.TransferState |
getState()
Returns the current state of this transfer.
|
boolean |
isDone()
Returns whether or not the transfer is finished (i.e.
|
void |
notifyStateChangeListeners(Transfer.TransferState state)
Notifies all the registered state change listeners of the state update.
|
void |
removeProgressListener(com.amazonaws.event.ProgressListener listener)
Removes the specified progress listener from the list of progress
listeners receiving updates about this transfer's progress.
|
void |
removeProgressListener(ProgressListener listener)
Deprecated.
Replaced by
removeProgressListener(ProgressListener) |
void |
removeStateChangeListener(TransferStateChangeListener listener)
Removes the given state change listener from the collection of listeners.
|
protected void |
rethrowExecutionException(ExecutionException e)
Examines the cause of the specified ExecutionException and either
rethrows it directly (if it's a type of AmazonClientException) or wraps
it in an AmazonClientException and rethrows it.
|
void |
setMonitor(TransferMonitor monitor)
Sets the monitor used to poll for transfer completion.
|
void |
setState(Transfer.TransferState state)
Sets the current state of this transfer.
|
protected com.amazonaws.AmazonClientException |
unwrapExecutionException(ExecutionException e)
Unwraps the root exception that caused the specified ExecutionException
and returns it.
|
void |
waitForCompletion()
Waits for this transfer to complete.
|
com.amazonaws.AmazonClientException |
waitForException()
Waits for this transfer to finish and returns any error that occurred, or
returns
null if no errors occurred. |
protected volatile Transfer.TransferState state
protected TransferMonitor monitor
protected final com.amazonaws.event.ProgressListenerChain listenerChain
protected final Collection<TransferStateChangeListener> stateChangeListeners
public final boolean isDone()
public void waitForCompletion()
throws com.amazonaws.AmazonClientException,
com.amazonaws.AmazonServiceException,
InterruptedException
waitForCompletion in interface Transfercom.amazonaws.AmazonClientException - If any errors were encountered in the client while making the
request or handling the response.com.amazonaws.AmazonServiceException - If any errors occurred in Amazon S3 while processing the
request.InterruptedException - If this thread is interrupted while waiting for the transfer
to complete.public com.amazonaws.AmazonClientException waitForException()
throws InterruptedException
null if no errors occurred.
This is a blocking call; the current thread
will be suspended until this transfer either fails or completes
successfully.waitForException in interface Transfernull if no errors occurred.InterruptedException - If this thread is interrupted while waiting for the transfer
to complete.public String getDescription()
getDescription in interface Transferpublic Transfer.TransferState getState()
public void setState(Transfer.TransferState state)
public void notifyStateChangeListeners(Transfer.TransferState state)
public void addProgressListener(com.amazonaws.event.ProgressListener listener)
addProgressListener in interface Transferlistener - The progress listener to add.public void removeProgressListener(com.amazonaws.event.ProgressListener listener)
removeProgressListener in interface Transferlistener - The progress listener to remove.@Deprecated public void addProgressListener(ProgressListener listener)
addProgressListener(ProgressListener)addProgressListener in interface Transfer@Deprecated public void removeProgressListener(ProgressListener listener)
removeProgressListener(ProgressListener)removeProgressListener in interface Transferpublic void addStateChangeListener(TransferStateChangeListener listener)
public void removeStateChangeListener(TransferStateChangeListener listener)
public TransferProgress getProgress()
getProgress in interface Transferpublic void setMonitor(TransferMonitor monitor)
public TransferMonitor getMonitor()
protected void fireProgressEvent(com.amazonaws.event.ProgressEventType eventType)
protected void rethrowExecutionException(ExecutionException e)
e - The execution exception to examine.protected com.amazonaws.AmazonClientException unwrapExecutionException(ExecutionException e)
e - The ExecutionException to unwrap.Copyright © 2014. All rights reserved.