Class AsynchronousValidationRequest

  • All Implemented Interfaces:
    java.lang.Runnable

    public class AsynchronousValidationRequest
    extends java.lang.Object
    implements java.lang.Runnable
    Class used to represent an asynchronous revalidation event, such as with "stale-while-revalidate"
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • revalidateCacheEntry

        private boolean revalidateCacheEntry()
        Revalidate the cache entry and return if the operation was successful. Success means a connection to the server was established and replay did not indicate a server error.
        Returns:
        true if the cache entry was successfully validated; otherwise false
      • isNotServerError

        private boolean isNotServerError​(int statusCode)
        Return whether the status code indicates a server error or not.
        Parameters:
        statusCode - the status code to be checked
        Returns:
        if the status code indicates a server error or not
      • isNotStale

        private boolean isNotStale​(org.apache.http.HttpResponse httpResponse)
        Try to detect if the returned response is generated from a stale cache entry.
        Parameters:
        httpResponse - the response to be checked
        Returns:
        whether the response is stale or not
      • getIdentifier

        public java.lang.String getIdentifier()
      • getConsecutiveFailedAttempts

        public int getConsecutiveFailedAttempts()
        The number of consecutively failed revalidation attempts.
        Returns:
        the number of consecutively failed revalidation attempts.