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

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

Best Java code snippets using com.github.rholder.retry.RetryException.getLastFailedAttempt (Showing top 7 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: 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: 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: 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: 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());
origin: olacabs/fabric

} catch (RetryException e) {
  LOGGER.error("Retry error getting leaders for partitions of " + topic, e);
  LOGGER.error("ATTEMPT EXCEPTION: ", e.getLastFailedAttempt().getExceptionCause());
  throw new BrokerQueryException("Error finding broker:", e.getLastFailedAttempt().getExceptionCause());
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());
  }
}
com.github.rholder.retryRetryExceptiongetLastFailedAttempt

Javadoc

Returns the last failed attempt

Popular methods of RetryException

  • 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

  • Making http post requests using okhttp
  • startActivity (Activity)
  • scheduleAtFixedRate (Timer)
  • getResourceAsStream (ClassLoader)
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JComboBox (javax.swing)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Best plugins for Eclipse
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