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.
  • Constructor Details

  • Method Details

    • progressChanged

      public 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.

      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 interface ProgressListener
      Parameters:
      progressEvent - The event describing the progress change.
      See Also:
    • throwExceptionIfAny

      public void throwExceptionIfAny()
      Throws the underlying exception, if any, as an AmazonClientException; or do nothing otherwise.
    • getCause

      public Throwable 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 interface DeliveryMode