Package com.google.walkaround.util.server.RetryHelper

Examples of com.google.walkaround.util.server.RetryHelper.PermanentFailure


    @Override public long delayMillisBeforeRetry(int numRetries, long millisSoFar,
        RetryableFailure exception) throws PermanentFailure {
      if (numRetries == 0) {
        return 0;
      } else {
        throw new PermanentFailure(exception);
      }
    }
View Full Code Here


  private static void maybeFail(Random random, double permanentFailureLikelihood,
      double retryableFailureLikelihood)
      throws RetryableFailure, PermanentFailure {
    if (randomChance(random, permanentFailureLikelihood)) {
      throw new PermanentFailure();
    }
    if (randomChance(random, retryableFailureLikelihood)) {
      throw new RetryableFailure();
    }
  }
View Full Code Here

    if (message.isYourTurnMessage()) {
      throw new AssertionError(this + ": Expected result message, not " + message);
    } else if (message.isResultMessage()) {
      return message.asResultMessage().getResult();
    } else if (message.isPermanentFailureMessage()) {
      throw new PermanentFailure("Worker thread reported PermanentFailure",
          message.asPermanentFailureMessage().getFailure());
    } else {
      throw new AssertionError(this + ": Unexpected message type: " + message);
    }
  }
View Full Code Here

      throw failure;
    } catch (Error e) {
      // Log this in case the finally clause below masks it with another exception.
      log.log(Level.SEVERE, "Error in doWork()", e);
      addPermanentFailureMessages(messagesToSend,
          new PermanentFailure("Error in doWork()", e));
      throw e;
    } catch (RuntimeException e) {
      // Log this in case the finally clause below masks it with another exception.
      log.log(Level.SEVERE, "RuntimeException in doWork()", e);
      addPermanentFailureMessages(messagesToSend,
          new PermanentFailure("RuntimeException in doWork()", e));
      throw e;
    } finally {
      // Note that it is possible that messagesToSend is empty: If the batch succeeded and
      // all results were rejections.
      List<QueueItem> removed = removeWaitingItems(messagesToSend.size());
View Full Code Here

          }
          log.log(Level.INFO, "doWork(): batch too large", e);
          break;
        } catch (Error e) {
          dropRequest(iterator, next, PermanentFailureMessage.<R>of(
              new PermanentFailure("processUpdate() threw Error", e)));
          throw e;
        } catch (RuntimeException e) {
          dropRequest(iterator, next, PermanentFailureMessage.<R>of(
              new PermanentFailure("processUpdate() threw RuntimeException", e)));
          throw e;
        }
        log.info("doWork(): result=" + result);
        assertWorker();
        if (result.isRejected()) {
View Full Code Here

    } catch (DatastoreTimeoutException e) {
      throw new RetryableFailure(e);
    } catch (ConcurrentModificationException e) {
      throw new RetryableFailure(e);
    } catch (DatastoreFailureException e) {
      throw new PermanentFailure(e);
    } catch (DatastoreNeedIndexException e) {
      throw new PermanentFailure(e);
    } catch (PreparedQuery.TooManyResultsException e) {
      throw new PermanentFailure(e);
    }
  }
View Full Code Here

            @Override public JSONObject run() throws RetryableFailure, PermanentFailure {
              JSONObject result;
              try {
                result = parseJsonResponseBody(fetch.fetch(req, robotErrorCode401Detector));
              } catch (IOException e) {
                throw new PermanentFailure("IOException with " + method + ": " + req, e);
              }
              log.info("result=" + ValueUtils.abbrev("" + result, 500));
              try {
                if (result.has("error")) {
                  log.warning("Error result: " + result);
View Full Code Here

    while (it.hasNext()) {
      ChangeData<String> delta = it.next();
      try {
        state.apply(delta);
      } catch (ChangeRejected e) {
        throw new PermanentFailure(
            "Corrupt snapshot or delta history " + objectId + " @" + state.getVersion(), e);
      }
    }
    if (atVersion != null && state.getVersion() < atVersion) {
      throw new RuntimeException("Object max version is " + state.getVersion()
View Full Code Here

TOP

Related Classes of com.google.walkaround.util.server.RetryHelper.PermanentFailure

Copyright © 2018 www.massapicom. 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.