Tabnine Logo
RetryException
Code IndexAdd Tabnine to your IDE (free)

How to use
RetryException
in
com.github.rholder.retry

Best Java code snippets using com.github.rholder.retry.RetryException (Showing top 20 results out of 315)

origin: Netflix/conductor

String errorMessage = String.format("Operation '%s:%s' failed after retrying %d times, retry limit %d", operationName,
    shortDescription, internalNumberOfRetries.get(), 3);
logger.debug(errorMessage, retryException.getLastFailedAttempt().getExceptionCause());
throw new RuntimeException(errorMessage, retryException.getLastFailedAttempt().getExceptionCause());
origin: Graylog2/graylog2-server

} catch (RetryException e) {
  LOG.warn("Tried to update session 10 times, but still failed. This is likely because of https://jira.mongodb.org/browse/SERVER-14322", e);
  throw new RuntimeException(e.getCause());
origin: Graylog2/graylog2-server

private BulkResult runBulkRequest(final Bulk request, int count) {
  try {
    return BULK_REQUEST_RETRYER.call(() -> client.execute(request));
  } catch (ExecutionException | RetryException e) {
    if (e instanceof RetryException) {
      LOG.error("Could not bulk index {} messages. Giving up after {} attempts.", count, ((RetryException) e).getNumberOfFailedAttempts());
    } else {
      LOG.error("Couldn't bulk index " + count + " messages.", e);
    }
    throw new RuntimeException(e);
  }
}
origin: rhuffman/re-retrying

@Test
public void testRetryIfResult() throws Exception {
  Callable<Boolean> callable = notNullAfter5Attempts();
  Retryer retryer = RetryerBuilder.newBuilder()
      .retryIfResult(Objects::isNull)
      .build();
  assertTrue(retryer.call(callable));
  callable = notNullAfter5Attempts();
  retryer = RetryerBuilder.newBuilder()
      .retryIfResult(Objects::isNull)
      .withStopStrategy(StopStrategies.stopAfterAttempt(3))
      .build();
  try {
    retryer.call(callable);
    fail("Exception expected");
  } catch (RetryException e) {
    assertEquals(3, e.getNumberOfFailedAttempts());
    assertTrue(e.getLastFailedAttempt().hasResult());
    assertNull(e.getLastFailedAttempt().getResult());
    assertNull(e.getCause());
  }
}
origin: HubSpot/Singularity

 metrics.error();
 LOG.warn("{} Couldn't upload or delete {}", logIdentifier, file, re);
 exceptionNotifier.notify(String.format("%s exception during upload", re.getCause().getClass()), re.getCause(), ImmutableMap.of("logIdentifier", logIdentifier, "file", file.toString(), "failedAttempts", Integer.toString(re.getNumberOfFailedAttempts())));
} catch (Exception e) {
 metrics.error();
origin: rhuffman/re-retrying

/**
 * Throw the Attempt's exception, if it has one, wrapped in a RetryException. Otherwise,
 * return the attempt's result.
 *
 * @param attempt An attempt that was made by invoking the call
 * @param <T>     The type of the attempt
 * @return The result of the attempt
 * @throws RetryException If the attempt has an exception
 */
private <T> T getOrThrow(Attempt<T> attempt) throws RetryException {
  if (attempt.hasException()) {
    throw new RetryException(attempt);
  }
  return attempt.get();
}
origin: ICOnator/ICOnator-backend

@Override
public List<Identification> fetchIdentifications() {
  List<Identification> identificationList = new ArrayList<>();
  String authToken = null;
  try {
    authToken = login();
  } catch (ExecutionException ee) {
    LOG.error("Error while logging in", ee.getMessage());
  } catch (RetryException re) {
    LOG.error("Reached max number of retries while logging in", re.getMessage());
  }
  if(authToken != null) {
    try {
      identificationList = getIdentifications(authToken);
    } catch (ExecutionException ee) {
      LOG.error("Error while getting identifications", ee.getMessage());
    } catch (RetryException re) {
      LOG.error("Reached maximum number of retries while getting identifications", re.getMessage());
    }
  } else {
    LOG.error("AuthToken still null after login"); //Should never happen
  }
  return identificationList;
}

origin: com.github.rholder/guava-retrying

  throw new RetryException(attemptNumber, attempt);
} else {
  long sleepTime = waitStrategy.computeSleepTime(attempt);
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    throw new RetryException(attemptNumber, attempt);
origin: wyh-spring-ecosystem-student/spring-boot-student

  logger.error(e.getMessage(), e);
} catch (RetryException e) {
  logger.error(e.getMessage(), e);
origin: addthis/hydra

private byte[] retrieveBytes(String url) {
  MutableInt retry = new MutableInt(0);
  try {
    return retryer.call(() -> request(url, retry));
  } catch (ExecutionException e) {
    throw Throwables.propagate(e.getCause());
  } catch (RetryException e) {
    if (e.getLastFailedAttempt().hasException()) {
      throw new RuntimeException("Max retries exceeded", e.getLastFailedAttempt().getExceptionCause());
    } else {
      throw new RuntimeException("Max retries exceeded", e);
    }
  }
}
origin: org.graylog2/graylog2-server

} catch (RetryException e) {
  LOG.warn("Tried to update session 10 times, but still failed. This is likely because of https://jira.mongodb.org/browse/SERVER-14322", e);
  throw new RuntimeException(e.getCause());
origin: org.graylog2/graylog2-server

private BulkResult runBulkRequest(final Bulk request, int count) {
  try {
    return BULK_REQUEST_RETRYER.call(() -> client.execute(request));
  } catch (ExecutionException | RetryException e) {
    if (e instanceof RetryException) {
      LOG.error("Could not bulk index {} messages. Giving up after {} attempts.", count, ((RetryException) e).getNumberOfFailedAttempts());
    } else {
      LOG.error("Couldn't bulk index " + count + " messages.", e);
    }
    throw new RuntimeException(e);
  }
}
origin: rhuffman/re-retrying

  throw new RetryException(attempt);
} else {
  long sleepTime = waitStrategy.computeSleepTime(attempt);
origin: Netflix/metacat

private void handleException(final String request,
               final String type,
               final List<String> ids,
               final Exception exception,
               final String metricName) {
  log.error("Failed {} metadata of type {} with ids {}. {}", request, type, ids, exception);
  String exceptionName = exception.getClass().getSimpleName();
  if (exception instanceof RetryException) {
    final Throwable error = ((RetryException) exception).getLastFailedAttempt().getExceptionCause();
    if (error != null) {
      exceptionName = error.getClass().getSimpleName();
    }
  }
  final Map<String, String> tags = ImmutableMap
    .<String, String>builder().put("status", "failure").put("exception", exceptionName).build();
  registry.counter(registry.createId(metricName).withTags(tags)).increment();
  log(request, type, ids.toString(), null, exception.getMessage(), exception, true);
}
origin: co.cask.wrangler/wrangler-core

} catch (RetryException e) {
 throw new DirectiveExecutionException(
  String.format("Issue in retrieving schema from schema registry. %s", e.getCause())
 );
origin: viltgroup/minium

public void forPredicate(Elements elements, Duration timeout, Duration interval, Predicate<? super Elements> predicate) {
  Configuration configuration = elements.as(HasConfiguration.class).configure();
  if (timeout == null) {
    timeout = configuration.defaultTimeout();
  }
  if (interval == null) {
    interval = configuration.defaultInterval();
  }
  Retryer<Elements> retrier = getRetryer(predicate, timeout, interval);
  try {
    retrier.call(Callables.returning(elements));
  } catch (RetryException e) {
    // if interrupted, we need to propagate it with the thread marked as interrupted
    if (Thread.interrupted()) {
      Thread.currentThread().interrupt();
      throw Throwables.propagate(e);
    }
    throw new TimeoutException(predicate, elements, e.getNumberOfFailedAttempts());
  } catch (ExecutionException e) {
    throw Throwables.propagate(e.getCause());
  }
}
origin: Netflix/metacat

private void handleException(final String request,
               final String type,
               final String id,
               final Exception exception,
               final String metricName) {
  log.error("Failed {} metadata of type {} with id {}. {}", request, type, id, exception);
  String exceptionName = exception.getClass().getSimpleName();
  if (exception instanceof RetryException) {
    final Throwable error = ((RetryException) exception).getLastFailedAttempt().getExceptionCause();
    if (error != null) {
      exceptionName = error.getClass().getSimpleName();
    }
  }
  final Map<String, String> tags = ImmutableMap
    .<String, String>builder().put("status", "failure").put("name", id).put("exception", exceptionName).build();
  registry.counter(registry.createId(metricName).withTags(tags)).increment();
  log(request, type, id, null, exception.getMessage(), exception, true);
}
origin: co.cask.wrangler/wrangler-core

} catch (RetryException e) {
 throw new DirectiveExecutionException(
  String.format("Issue in retrieving protobuf descriptor from schema registry. %s", e.getCause())
 );
origin: rhuffman/re-retrying

@Test
public void testWithStopStrategy() throws Exception {
  Callable<Boolean> callable = notNullAfter5Attempts();
  Retryer retryer = RetryerBuilder.newBuilder()
      .withStopStrategy(StopStrategies.stopAfterAttempt(3))
      .retryIfResult(Objects::isNull)
      .build();
  try {
    retryer.call(callable);
    fail("RetryException expected");
  } catch (RetryException e) {
    assertEquals(3, e.getNumberOfFailedAttempts());
  }
}
origin: com.netflix.conductor/conductor-common

String errorMessage = String.format("Operation '%s:%s' failed after retrying %d times, retry limit %d", operationName,
    shortDescription, internalNumberOfRetries.get(), 3);
logger.debug(errorMessage, retryException.getLastFailedAttempt().getExceptionCause());
throw new RuntimeException(errorMessage, retryException.getLastFailedAttempt().getExceptionCause());
com.github.rholder.retryRetryException

Javadoc

An exception indicating that none of the attempts of the Retryersucceeded. If the last Attempt resulted in an Exception, it is set as the cause of the RetryException.

Most used methods

  • getLastFailedAttempt
    Returns the last failed attempt
  • getCause
  • getNumberOfFailedAttempts
    Returns the number of failed attempts
  • <init>
    If the last Attempt had an Exception, ensure it is available in the stack trace.
  • getMessage

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now