Package com.amazonaws.event
Class ProgressListener.ExceptionReporter
java.lang.Object
com.amazonaws.event.ProgressListener.ExceptionReporter
- All Implemented Interfaces:
DeliveryMode
,ProgressListener
- Enclosing interface:
ProgressListener
public static class ProgressListener.ExceptionReporter
extends Object
implements ProgressListener, DeliveryMode
A utility class for capturing and reporting the first exception thrown by
a given progress listener. Note once an exception is thrown by the
underlying listener, all subsequent events will no longer be notified to
the listener.
-
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 -
Method Summary
Modifier and TypeMethodDescriptiongetCause()
Returns the underlying exception, if any; or null otherwise.boolean
Returns true if it is safe to make a synchronous callback to the implementing listener without the risk of incurring undue latency; false otherwise.void
progressChanged
(ProgressEvent progressEvent) Delivers the progress event to the underlying listener but only if there has not been an exception previously thrown by the listener.void
Throws the underlying exception, if any, as anAmazonClientException
; or do nothing otherwise.wrap
(ProgressListener listener) Returns a wrapper for the given listener to capture the first exception thrown.
-
Constructor Details
-
ExceptionReporter
-
-
Method Details
-
progressChanged
Delivers the progress event to the underlying listener but only if there has not been an exception previously thrown by the listener.Called when progress has changed, such as additional bytes transferred, transfer failed, etc. The execution of the callback of this listener is managed by
SDKProgressPublisher
. 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
wrap(ProgressListener)
.- Specified by:
progressChanged
in interfaceProgressListener
- Parameters:
progressEvent
- The event describing the progress change.- See Also:
-
throwExceptionIfAny
public void throwExceptionIfAny()Throws the underlying exception, if any, as anAmazonClientException
; or do nothing otherwise. -
getCause
Returns the underlying exception, if any; or null otherwise. -
wrap
Returns a wrapper for the given listener to capture the first exception thrown. -
isSyncCallSafe
public boolean isSyncCallSafe()Description copied from interface:DeliveryMode
Returns 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:
isSyncCallSafe
in interfaceDeliveryMode
-