com.alarmpoint.integrationagent.exceptions.retriable
Class RetriableException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.alarmpoint.integrationagent.exceptions.retriable.RetriableException
All Implemented Interfaces:
java.io.Serializable

public class RetriableException
extends java.lang.Exception

An exception wrapper with an associated retry policy. The retry policy is applied against the input that caused the exception.

See Also:
Serialized Form

Constructor Summary
RetriableException(java.lang.Throwable cause, int maxAttempts, long delayMillis)
          A convenience constructor that wraps an exception with a retry policy that has a maximum attempt limit and a fixed delay between retries.
RetriableException(java.lang.Throwable cause, RetryPolicy retryPolicy)
          Wraps an exception with a retry policy.
 
Method Summary
 RetryPolicy getRetryPolicy()
          Gets the retry policy that applies to the wrapped exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RetriableException

public RetriableException(java.lang.Throwable cause,
                          RetryPolicy retryPolicy)
Wraps an exception with a retry policy.

Parameters:
cause - - the wrapped exception; may be null if unknown
retryPolicy - - the retryPolicy policy that should apply to the wrapped exception; must be non-null

RetriableException

public RetriableException(java.lang.Throwable cause,
                          int maxAttempts,
                          long delayMillis)
A convenience constructor that wraps an exception with a retry policy that has a maximum attempt limit and a fixed delay between retries.

Parameters:
cause - - the wrapped exception; may be null if unknown
maxAttempts - - the maximum number of attempts (first attempt and retries) that will be allowed; must be >= 1
delayMillis - - the miminum delay (in milliseconds) between each retry attempt; must be >= 0 with 0 indicating no delay
Method Detail

getRetryPolicy

public RetryPolicy getRetryPolicy()
Gets the retry policy that applies to the wrapped exception.

Returns:
a non-null RetryPolicy