public static class ProgressListener.ExceptionReporter extends Object implements ProgressListener, DeliveryMode
ProgressListener.ExceptionReporter, ProgressListener.NoOpProgressListener
DeliveryMode.Check
NOOP
Constructor and Description |
---|
ExceptionReporter(ProgressListener listener) |
Modifier and Type | Method and Description |
---|---|
Throwable |
getCause()
Returns the underlying exception, if any; or null otherwise.
|
boolean |
isSyncCallSafe()
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 |
throwExceptionIfAny()
Throws the underlying exception, if any, as an
SdkClientException ; or do nothing otherwise. |
static ProgressListener.ExceptionReporter |
wrap(ProgressListener listener)
Returns a wrapper for the given listener to capture the first
exception thrown.
|
public ExceptionReporter(ProgressListener listener)
public void progressChanged(ProgressEvent progressEvent)
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)
.
progressChanged
in interface ProgressListener
progressEvent
- The event describing the progress change.SDKProgressPublisher
,
ProgressListener.ExceptionReporter
public void throwExceptionIfAny()
SdkClientException
; or do nothing otherwise.public Throwable getCause()
public static ProgressListener.ExceptionReporter wrap(ProgressListener listener)
public boolean isSyncCallSafe()
DeliveryMode
isSyncCallSafe
in interface DeliveryMode