Java Code Examples for com.google.ipc.invalidation.external.client.SystemResources#Scheduler
The following examples show how to use
com.google.ipc.invalidation.external.client.SystemResources#Scheduler .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AndroidChannel.java From android-chromium with BSD 2-Clause "Simplified" License | 6 votes |
/** * A utility function to run an async runnable with exponential backoff after failures. * @param runnable the asynchronous runnable. * @param scheduler used to schedule retries. * @param backOffGenerator a backoff generator that returns how to long to wait between retries. * The client must pass a new instance or reset the backoff generator before calling this * method. */ static void retryUntilSuccessWithBackoff(final SystemResources.Scheduler scheduler, final ExponentialBackoffDelayGenerator backOffGenerator, final AsyncRunnable runnable) { logger.fine("Running %s", runnable); runnable.run(new CompletionCallback() { @Override public void success() { logger.fine("%s succeeded", runnable); } @Override public void failure() { int nextDelay = backOffGenerator.getNextDelay(); logger.fine("%s failed, retrying after %s ms", nextDelay); scheduler.schedule(nextDelay, new Runnable() { @Override public void run() { retryUntilSuccessWithBackoff(scheduler, backOffGenerator, runnable); } }); } }); }
Example 2
Source File: AndroidChannel.java From android-chromium with BSD 2-Clause "Simplified" License | 6 votes |
/** * A utility function to run an async runnable with exponential backoff after failures. * @param runnable the asynchronous runnable. * @param scheduler used to schedule retries. * @param backOffGenerator a backoff generator that returns how to long to wait between retries. * The client must pass a new instance or reset the backoff generator before calling this * method. */ static void retryUntilSuccessWithBackoff(final SystemResources.Scheduler scheduler, final ExponentialBackoffDelayGenerator backOffGenerator, final AsyncRunnable runnable) { logger.fine("Running %s", runnable); runnable.run(new CompletionCallback() { @Override public void success() { logger.fine("%s succeeded", runnable); } @Override public void failure() { int nextDelay = backOffGenerator.getNextDelay(); logger.fine("%s failed, retrying after %s ms", nextDelay); scheduler.schedule(nextDelay, new Runnable() { @Override public void run() { retryUntilSuccessWithBackoff(scheduler, backOffGenerator, runnable); } }); } }); }
Example 3
Source File: TestableInvalidationClient.java From 365browser with Apache License 2.0 | 4 votes |
/** Returns the client internal scheduler */ SystemResources.Scheduler getInternalSchedulerForTest();
Example 4
Source File: TestableInvalidationClient.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
/** Returns the client internal scheduler */ SystemResources.Scheduler getInternalSchedulerForTest();
Example 5
Source File: TestableInvalidationClient.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
/** Returns the client internal scheduler */ SystemResources.Scheduler getInternalSchedulerForTest();