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

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

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

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: 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: 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: 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: 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: 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.retryRetryExceptiongetNumberOfFailedAttempts

Javadoc

Returns the number of failed attempts

Popular methods of RetryException

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

Popular in Java

  • Reading from database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • onRequestPermissionsResult (Fragment)
  • Menu (java.awt)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Table (org.hibernate.mapping)
    A relational table
  • Top Sublime Text plugins
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