Codota Logo
Retries.run
Code IndexAdd Codota to your IDE (free)

How to use
run
method
in
org.apache.bookkeeper.common.util.Retries

Best Java code snippets using org.apache.bookkeeper.common.util.Retries.run (Showing top 9 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: apache/pulsar

private void cleanupOffloaded(long ledgerId, UUID uuid, String offloadDriverName, /*
                                          * TODO: use driver name to
                                          * identify offloader
                                          */
    Map<String, String> offloadDriverMetadata, String cleanupReason) {
  Retries.run(Backoff.exponentialJittered(TimeUnit.SECONDS.toMillis(1), TimeUnit.SECONDS.toHours(1)).limit(10),
      Retries.NonFatalPredicate,
      () -> config.getLedgerOffloader().deleteOffloaded(ledgerId, uuid, offloadDriverMetadata),
      scheduledExecutor, name).whenComplete((ignored, exception) -> {
        if (exception != null) {
          log.warn("Error cleaning up offload for {}, (cleanup reason: {})", ledgerId, cleanupReason,
              exception);
        }
      });
}
origin: apache/pulsar

.thenCompose(readHandle -> config.getLedgerOffloader().offload(readHandle, uuid, extraMetadata))
.thenCompose((ignore) -> {
    return Retries.run(Backoff.exponentialJittered(TimeUnit.SECONDS.toMillis(1),
                            TimeUnit.SECONDS.toHours(1)).limit(10),
              FAIL_ON_CONFLICT,
origin: org.apache.bookkeeper/bookkeeper-common

/**
 * Retry a given {@code task} on failures.
 *
 * <p>It is a shortcut of {@link #run(Stream, Predicate, Supplier, OrderedScheduler, Object)}
 * that runs retries on any threads in the provided {@code scheduler}.
 *
 * @param backoffs       a stream of backoff delays, in milliseconds.
 * @param retryPredicate a predicate to test if failures are retryable.
 * @param task           a task to execute.
 * @param scheduler      scheduler to schedule the task and complete the futures.
 * @param <ReturnT>      the return type
 * @return future represents the result of the task with retries.
 */
public static <ReturnT> CompletableFuture<ReturnT> run(
  Stream<Long> backoffs,
  Predicate<Throwable> retryPredicate,
  Supplier<CompletableFuture<ReturnT>> task,
  OrderedScheduler scheduler) {
  return run(backoffs, retryPredicate, task, scheduler, null);
}
origin: org.apache.bookkeeper/stream-storage-java-client-base

private <T> CompletableFuture<T> runRpcWithRetries(
    Supplier<CompletableFuture<T>> futureSupplier) {
  return Retries.run(
    backoffPolicy.toBackoffs(),
    ROOT_RANGE_CLIENT_RETRY_PREDICATE,
    futureSupplier,
    scheduler);
}
origin: org.apache.bookkeeper/stream-storage-java-client-base

/**
 * Run the action with retries.
 *
 * @param action action to run
 * @return the result of the action
 */
public <T> CompletableFuture<T> execute(Supplier<CompletableFuture<T>> action) {
  return Retries.run(
    backoffPolicy.toBackoffs(),
    retryPredicate,
    action,
    scheduler
  );
}
origin: org.apache.bookkeeper/stream-storage-java-client-base

/**
 * Run the action with retries.
 *
 * @param action action to run
 * @return the result of the action
 */
public <T> CompletableFuture<T> executeListenable(Supplier<ListenableFuture<T>> action) {
  return Retries.run(
    backoffPolicy.toBackoffs(),
    retryPredicate,
    () -> fromListenableFuture(action.get()),
    scheduler
  );
}
origin: org.apache.pulsar/managed-ledger-original

private void cleanupOffloaded(long ledgerId,
               UUID uuid,
               String offloadDriverName, /* TODO: use driver name to identify offloader */
               Map<String, String> offloadDriverMetadata,
               String cleanupReason) {
  Retries.run(Backoff.exponentialJittered(TimeUnit.SECONDS.toMillis(1), TimeUnit.SECONDS.toHours(1)).limit(10),
        Retries.NonFatalPredicate,
        () -> config.getLedgerOffloader().deleteOffloaded(ledgerId, uuid, offloadDriverMetadata),
        scheduledExecutor, name)
    .whenComplete((ignored, exception) -> {
        if (exception != null) {
          log.warn("Error cleaning up offload for {}, (cleanup reason: {})",
               ledgerId, cleanupReason, exception);
        }
      });
}
origin: org.apache.bookkeeper/stream-storage-java-client-base

@Override
public CompletableFuture<List<OneStorageContainerEndpointResponse>>
locateStorageContainers(List<Revisioned<Long>> storageContainerIds) {
  GetStorageContainerEndpointRequest request = createGetStorageContainerEndpointRequest(storageContainerIds);
  return Retries.run(
    getDefaultBackoffs(),
    LOCATE_STORAGE_CONTAINERS_RETRY_PREDICATE,
    () -> fromListenableFuture(
      locationService.getStorageContainerEndpoint(request),
      GetStorageContainerEndpointsFunction),
    scheduler,
    request);
}
origin: org.apache.pulsar/managed-ledger-original

.thenCompose(readHandle -> config.getLedgerOffloader().offload(readHandle, uuid, extraMetadata))
.thenCompose((ignore) -> {
    return Retries.run(Backoff.exponentialJittered(TimeUnit.SECONDS.toMillis(1),
                            TimeUnit.SECONDS.toHours(1)).limit(10),
              FAIL_ON_CONFLICT,
org.apache.bookkeeper.common.utilRetriesrun

Javadoc

Retry a given task on failures.

It is a shortcut of #run(Stream,Predicate,Supplier,OrderedScheduler,Object)that runs retries on any threads in the provided scheduler.

Popular methods of Retries

  • execute

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now