Interface HttpTransporter

    • Method Summary

      All Methods Static Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default int classify​(java.lang.Throwable error)
      Classifies the type of exception that has been thrown from a previous request to the transporter.
      static void logImmediateRetry​(org.slf4j.Logger logger, java.lang.String method, java.net.URI uri, int requestAttempt, int maxRequestAttempt, java.lang.Throwable exception)
      Log a retry message for an immediate retry.
      static void logRetry​(org.slf4j.Logger logger, java.lang.String method, java.net.URI uri, int requestAttempt, int maxRequestAttempt, java.lang.String reason, long retryDelay, java.lang.String retryDelayReason)
      Log a retry message for a delayed retry.
    • Method Detail

      • classify

        default int classify​(java.lang.Throwable error)
        Description copied from interface: Transporter
        Classifies the type of exception that has been thrown from a previous request to the transporter. The exception types employed by a transporter are generally unknown to its caller. Where a caller needs to distinguish between certain error cases, it employs this method to detect which error case corresponds to the exception.
        Specified by:
        classify in interface Transporter
        Parameters:
        error - The exception to classify, must not be null.
        Returns:
        The classification of the error, either Transporter.ERROR_NOT_FOUND or Transporter.ERROR_OTHER.
      • logImmediateRetry

        static void logImmediateRetry​(org.slf4j.Logger logger,
                                      java.lang.String method,
                                      java.net.URI uri,
                                      int requestAttempt,
                                      int maxRequestAttempt,
                                      java.lang.Throwable exception)
        Log a retry message for an immediate retry.
        Parameters:
        logger - the logger to log the retry message
        method - the HTTP method of the request (e.g. GET, PUT, etc.)
        uri - the URI of the request
        requestAttempt - the 0-based counter of the previous request attempt (0 for the first attempt, 1 for the first retry, etc.)
        maxRequestAttempt - the maximum number of request attempts (this is including this original request)
        exception - the exception that caused the immediate retry
      • logRetry

        static void logRetry​(org.slf4j.Logger logger,
                             java.lang.String method,
                             java.net.URI uri,
                             int requestAttempt,
                             int maxRequestAttempt,
                             java.lang.String reason,
                             long retryDelay,
                             java.lang.String retryDelayReason)
        Log a retry message for a delayed retry.
        Parameters:
        logger - the logger to log the retry message
        method - the HTTP method of the request (e.g. GET, PUT, etc.)
        uri - the URI of the request
        requestAttempt - the 0-based counter of the previous request attempt (0 for the first attempt, 1 for the first retry, etc.)
        maxRequestAttempt - the maximum number of request attempts (this is including this original request)
        reason - the reason for the retry (usually a status code or an exception)
        retryDelay - the interval in milliseconds before the next retry (0 or negative for immediate retry)
        retryDelayReason - the reason for the retry interval (may be empty if unknown)