Examples of RetryAfterException


Examples of org.apache.ace.agent.RetryAfterException

    protected URL getServerURL() throws RetryAfterException {
        // FIXME not sure if this is the proper place
        URL serverURL = getDiscoveryHandler().getServerUrl();
        if (serverURL == null) {
            throw new RetryAfterException(10);
        }
        return serverURL;
    }
View Full Code Here

Examples of org.apache.ace.agent.RetryAfterException

        }
        else if (rc == SC_SERVICE_UNAVAILABLE) {
            // Service is unavailable, throw an exception to try it again later...
            int retry = ((HttpURLConnection) conn).getHeaderFieldInt(HTTP_RETRY_AFTER, DEFAULT_RETRY_TIME);

            throw new RetryAfterException(retry);
        }

        throw new IOException("Unknown/unexpected status code: " + rc);
    }
View Full Code Here

Examples of org.apache.ace.agent.RetryAfterException

            case 200:
            case 206:
                return;
            case 503:
                int retry = ((HttpURLConnection) connection).getHeaderFieldInt(HTTP_RETRY_AFTER, DEFAULT_RETRY_TIME);
                throw new RetryAfterException(retry);
            default:
                throw new IOException("Unable to handle server responsecode: " + responseCode + ", for " + connection.getURL());
        }
    }
View Full Code Here

Examples of org.jclouds.rest.RetryAfterException

   public Optional<RetryAfterException> tryCreateRetryAfterException(Throwable in, String retryAfter) {
      checkNotNull(in, "throwable");
      checkNotNull(retryAfter, "retryAfter");

      if (retryAfter.matches("^[0-9]+$"))
         return Optional.of(new RetryAfterException(in, Integer.parseInt(retryAfter)));
      try {
         long retryTimeMillis = dateCodec.toDate(retryAfter).getTime();
         long currentTimeMillis = NANOSECONDS.toMillis(ticker.read());
         return Optional.of(new RetryAfterException(in, (int) MILLISECONDS.toSeconds(retryTimeMillis
               - currentTimeMillis)));
      } catch (IllegalArgumentException e) {
         // ignored
      }
      return Optional.absent();
View Full Code Here

Examples of org.jclouds.rest.RetryAfterException

   public Optional<RetryAfterException> tryCreateRetryAfterException(Throwable in, String retryAfter) {
      checkNotNull(in, "throwable");
      checkNotNull(retryAfter, "retryAfter");

      if (retryAfter.matches("^[0-9]+$"))
         return Optional.of(new RetryAfterException(in, Integer.parseInt(retryAfter)));
      try {
         long retryTimeMillis = dateCodec.toDate(retryAfter).getTime();
         long currentTimeMillis = NANOSECONDS.toMillis(ticker.read());
         return Optional.of(new RetryAfterException(in, (int) MILLISECONDS.toSeconds(retryTimeMillis
               - currentTimeMillis)));
      } catch (IllegalArgumentException e) {
         // ignored
      }
      return Optional.absent();
View Full Code Here

Examples of org.jclouds.rest.RetryAfterException

   public Optional<RetryAfterException> tryCreateRetryAfterException(Throwable in, String retryAfter) {
      checkNotNull(in, "throwable");
      checkNotNull(retryAfter, "retryAfter");

      if (retryAfter.matches("^[0-9]+$"))
         return Optional.of(new RetryAfterException(in, Integer.parseInt(retryAfter)));
      try {
         long retryTimeMillis = dateCodec.toDate(retryAfter).getTime();
         long currentTimeMillis = NANOSECONDS.toMillis(ticker.read());
         return Optional.of(new RetryAfterException(in, (int) MILLISECONDS.toSeconds(retryTimeMillis
               - currentTimeMillis)));
      } catch (IllegalArgumentException e) {
         // ignored
      }
      return Optional.absent();
View Full Code Here

Examples of org.jclouds.rest.RetryAfterException

   public Optional<RetryAfterException> tryCreateRetryAfterException(Throwable in, String retryAfter) {
      checkNotNull(in, "throwable");
      checkNotNull(retryAfter, "retryAfter");

      if (retryAfter.matches("^[0-9]+$"))
         return Optional.of(new RetryAfterException(in, Integer.parseInt(retryAfter)));
      try {
         long retryTimeMillis = dateCodec.toDate(retryAfter).getTime();
         long currentTimeMillis = NANOSECONDS.toMillis(ticker.read());
         return Optional.of(new RetryAfterException(in, (int) MILLISECONDS.toSeconds(retryTimeMillis
               - currentTimeMillis)));
      } catch (IllegalArgumentException e) {
         // ignored
      }
      return Optional.absent();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.