From d479253768d296a40b4f699e1de9b03c7146a97a Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Tue, 3 Dec 2013 14:03:28 -0800 Subject: Adding javadocs and Carbonado User Guide --- .../com/amazon/carbonado/RepositoryException.html | 499 +++++++++++++++++++++ 1 file changed, 499 insertions(+) create mode 100644 apidocs/com/amazon/carbonado/RepositoryException.html (limited to 'apidocs/com/amazon/carbonado/RepositoryException.html') diff --git a/apidocs/com/amazon/carbonado/RepositoryException.html b/apidocs/com/amazon/carbonado/RepositoryException.html new file mode 100644 index 0000000..c56e4cd --- /dev/null +++ b/apidocs/com/amazon/carbonado/RepositoryException.html @@ -0,0 +1,499 @@ + + + + + + +RepositoryException (Carbonado 1.2.3 API) + + + + + + + +
+ + + + + +
+ + + +
+
com.amazon.carbonado
+

Class RepositoryException

+
+
+ +
+
    +
  • +
    +
    All Implemented Interfaces:
    +
    java.io.Serializable
    +
    +
    +
    Direct Known Subclasses:
    +
    FetchException, PersistException, SupportException
    +
    +
    +
    +
    public class RepositoryException
    +extends java.lang.Exception
    +
    General checked exception thrown when accessing a Repository. + +

    Some repository exceptions are the result of an optimistic lock failure + or deadlock. One resolution strategy is to exit all transactions and try the + operation again, after waiting some bounded random amount of time. As a + convenience, this class provides a mechanism to support such a backoff + strategy. For example: + +

    + // Retry at most three more times
    + for (int retryCount = 3;;) {
    +     try {
    +         ...
    +         myObject.load();
    +         ...
    +         myObject.update();
    +         break;
    +     } catch (OptimisticLockException e) {
    +         // Wait up to one second before retrying
    +         retryCount = e.backoff(e, retryCount, 1000);
    +     }
    + }
    + 
    + + If the retry count is zero (or less) when backoff is called, then the + original exception is rethrown, indicating retry failure.
    +
    Author:
    +
    Brian S O'Neill
    +
    See Also:
    Serialized Form
    +
  • +
+
+
+
    +
  • + + + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Methods 
      Modifier and TypeMethod and Description
      static <E extends java.lang.Throwable> 
      int
      backoff(E e, + int retryCount, + int milliseconds) +
      One strategy for resolving an optimistic lock failure is to try the + operation again, after waiting some bounded random amount of time.
      +
      java.lang.ThrowablegetRootCause() +
      Recursively calls getCause, until the root cause is found.
      +
      protected FetchExceptionmakeFetchException(java.lang.String message, + java.lang.Throwable cause) +
      Subclasses can override this to provide a more specialized exception.
      +
      protected PersistExceptionmakePersistException(java.lang.String message, + java.lang.Throwable cause) +
      Subclasses can override this to provide a more specialized exception.
      +
      FetchExceptiontoFetchException() +
      Converts RepositoryException into an appropriate FetchException.
      +
      FetchExceptiontoFetchException(java.lang.String message) +
      Converts RepositoryException into an appropriate FetchException, prepending + the specified message.
      +
      PersistExceptiontoPersistException() +
      Converts RepositoryException into an appropriate PersistException.
      +
      PersistExceptiontoPersistException(java.lang.String message) +
      Converts RepositoryException into an appropriate PersistException, prepending + the specified message.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Throwable

        +addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, 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

      + + + +
        +
      • +

        RepositoryException

        +
        public RepositoryException()
        +
      • +
      + + + +
        +
      • +

        RepositoryException

        +
        public RepositoryException(java.lang.String message)
        +
      • +
      + + + +
        +
      • +

        RepositoryException

        +
        public RepositoryException(java.lang.String message,
        +                   java.lang.Throwable cause)
        +
      • +
      + + + +
        +
      • +

        RepositoryException

        +
        public RepositoryException(java.lang.Throwable cause)
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        backoff

        +
        public static <E extends java.lang.Throwable> int backoff(E e,
        +                                          int retryCount,
        +                                          int milliseconds)
        +                   throws E extends java.lang.Throwable
        +
        One strategy for resolving an optimistic lock failure is to try the + operation again, after waiting some bounded random amount of time. This + method is provided as a convenience, to support such a random wait. +

        + A retry count is required as well, which is decremented and returned by + this method. If the retry count is zero (or less) when this method is + called, then this exception is thrown again, indicating retry failure.

        +
        Parameters:
        retryCount - current retry count, if zero, throw this exception again
        milliseconds - upper bound on the random amount of time to wait
        +
        Returns:
        retryCount minus one
        +
        Throws:
        +
        E - if retry count is zero
        +
        E extends java.lang.Throwable
        +
      • +
      + + + +
        +
      • +

        getRootCause

        +
        public java.lang.Throwable getRootCause()
        +
        Recursively calls getCause, until the root cause is found. Returns this + if no root cause.
        +
      • +
      + + + +
        +
      • +

        toPersistException

        +
        public final PersistException toPersistException()
        +
        Converts RepositoryException into an appropriate PersistException.
        +
      • +
      + + + +
        +
      • +

        toPersistException

        +
        public final PersistException toPersistException(java.lang.String message)
        +
        Converts RepositoryException into an appropriate PersistException, prepending + the specified message. If message is null, original exception message is + preserved.
        +
        Parameters:
        message - message to prepend, which may be null
        +
      • +
      + + + +
        +
      • +

        toFetchException

        +
        public final FetchException toFetchException()
        +
        Converts RepositoryException into an appropriate FetchException.
        +
      • +
      + + + +
        +
      • +

        toFetchException

        +
        public final FetchException toFetchException(java.lang.String message)
        +
        Converts RepositoryException into an appropriate FetchException, prepending + the specified message. If message is null, original exception message is + preserved.
        +
        Parameters:
        message - message to prepend, which may be null
        +
      • +
      + + + +
        +
      • +

        makePersistException

        +
        protected PersistException makePersistException(java.lang.String message,
        +                                    java.lang.Throwable cause)
        +
        Subclasses can override this to provide a more specialized exception.
        +
        Parameters:
        message - exception message, which may be null
        cause - non-null cause
        +
      • +
      + + + +
        +
      • +

        makeFetchException

        +
        protected FetchException makeFetchException(java.lang.String message,
        +                                java.lang.Throwable cause)
        +
        Subclasses can override this to provide a more specialized exception.
        +
        Parameters:
        message - exception message, which may be null
        cause - non-null cause
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + +
+ + +

Copyright © 2006-2013 Amazon Technologies, Inc.. All Rights Reserved.

+ + -- cgit v1.2.3