Package com.amazonaws.event
Class ProgressListenerChain
- java.lang.Object
-
- com.amazonaws.event.ProgressListenerChain
-
- All Implemented Interfaces:
DeliveryMode,ProgressListener
public class ProgressListenerChain extends Object implements ProgressListener, DeliveryMode
An implementation of ProgressListener interface that delegates progressChanged callback to multiple listeners. It also takes an optional ProgressEventFilter to filter incoming events before passing them to the listeners.This class could be used for both Amazon S3 and Amazon Glacier clients. The legacy Amazon S3 progress listener chain com.amazonaws.services.s3.transfer.internal.ProgressListenerChain has been deprecated in favor of this new class.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.amazonaws.event.DeliveryMode
DeliveryMode.Check
-
Nested classes/interfaces inherited from interface com.amazonaws.event.ProgressListener
ProgressListener.ExceptionReporter, ProgressListener.NoOpProgressListener
-
-
Field Summary
-
Fields inherited from interface com.amazonaws.event.ProgressListener
NOOP
-
-
Constructor Summary
Constructors Constructor Description ProgressListenerChain(ProgressEventFilter progressEventFilter, ProgressListener... listeners)Create a listener chain with a ProgressEventFilter.ProgressListenerChain(ProgressListener... listeners)Create a listener chain that directly passes all the progress events to the specified listeners.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProgressListener(ProgressListener listener)protected List<ProgressListener>getListeners()Returns the listeners associated with this listener chain.booleanisSyncCallSafe()Returns true if it is safe to make a synchronous callback to the implementing listener without the risk of incurring undue latency; false otherwise.voidprogressChanged(ProgressEvent progressEvent)Called when progress has changed, such as additional bytes transferred, transfer failed, etc.voidremoveProgressListener(ProgressListener listener)
-
-
-
Constructor Detail
-
ProgressListenerChain
public ProgressListenerChain(ProgressListener... listeners)
Create a listener chain that directly passes all the progress events to the specified listeners.
-
ProgressListenerChain
public ProgressListenerChain(ProgressEventFilter progressEventFilter, ProgressListener... listeners)
Create a listener chain with a ProgressEventFilter.
-
-
Method Detail
-
addProgressListener
public void addProgressListener(ProgressListener listener)
-
removeProgressListener
public void removeProgressListener(ProgressListener listener)
-
getListeners
protected List<ProgressListener> getListeners()
Returns the listeners associated with this listener chain.
-
progressChanged
public void progressChanged(ProgressEvent progressEvent)
Description copied from interface:ProgressListenerCalled when progress has changed, such as additional bytes transferred, transfer failed, etc. The execution of the callback of this listener is managed bySDKProgressPublisher. Implementation of this interface should never block.If the implementation follows the best practice and doesn't block, it should then extends from
SyncProgressListener.Note any exception thrown by the listener will get ignored. Should there be need to capture any such exception, you may consider wrapping the listener with
ProgressListener.ExceptionReporter.wrap(ProgressListener).- Specified by:
progressChangedin interfaceProgressListener- Parameters:
progressEvent- The event describing the progress change.- See Also:
SDKProgressPublisher,ProgressListener.ExceptionReporter
-
isSyncCallSafe
public boolean isSyncCallSafe()
Description copied from interface:DeliveryModeReturns true if it is safe to make a synchronous callback to the implementing listener without the risk of incurring undue latency; false otherwise.- Specified by:
isSyncCallSafein interfaceDeliveryMode
-
-