本文整理匯總了Java中org.embulk.spi.util.RetryExecutor類的典型用法代碼示例。如果您正苦於以下問題:Java RetryExecutor類的具體用法?Java RetryExecutor怎麽用?Java RetryExecutor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RetryExecutor類屬於org.embulk.spi.util包,在下文中一共展示了RetryExecutor類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: executeWithRetry
import org.embulk.spi.util.RetryExecutor; //導入依賴的package包/類
public static <T> T executeWithRetry(int maximumRetries, int initialRetryIntervalMillis, int maximumRetryIntervalMillis, AlwaysRetryRetryable<T> alwaysRetryRetryable) throws RetryExecutor.RetryGiveupException, InterruptedException
{
return RetryExecutor
.retryExecutor()
.withRetryLimit(maximumRetries)
.withInitialRetryWait(initialRetryIntervalMillis)
.withMaxRetryWait(maximumRetryIntervalMillis)
.runInterruptible(alwaysRetryRetryable);
}
示例2: onRetry
import org.embulk.spi.util.RetryExecutor; //導入依賴的package包/類
@Override
public void onRetry(Exception exception, int retryCount, int retryLimit, int retryWait) throws RetryExecutor.RetryGiveupException
{
LOGGER.info("Retry [{}]/[{}] with retryWait [{}] on exception {}", retryCount, retryLimit, retryWait, exception.getMessage());
}
示例3: onGiveup
import org.embulk.spi.util.RetryExecutor; //導入依賴的package包/類
@Override
public void onGiveup(Exception firstException, Exception lastException) throws RetryExecutor.RetryGiveupException
{
LOGGER.info("Giving up execution on exception", lastException);
}
示例4: onRetry
import org.embulk.spi.util.RetryExecutor; //導入依賴的package包/類
@Override
public void onRetry(Exception exception, int retryCount, int retryLimit, int retryWait)
throws RetryExecutor.RetryGiveupException
{
logger.warn("retrying {}/{} after {} seconds. Message: {}",
retryCount, retryLimit, retryWait / 1000,
exception.getMessage());
}
示例5: onGiveup
import org.embulk.spi.util.RetryExecutor; //導入依賴的package包/類
@Override
public void onGiveup(Exception firstException, Exception lastException)
throws RetryExecutor.RetryGiveupException
{
logger.error("giveup {}", lastException.getMessage());
}
示例6: onRetry
import org.embulk.spi.util.RetryExecutor; //導入依賴的package包/類
@Override
public void onRetry(Exception exception, int retryCount, int retryLimit, int retryWait)
throws RetryExecutor.RetryGiveupException
{
String m = String.format(
"%s. (Retry: Count: %d, Limit: %d, Wait: %d ms)",
exception.getMessage(),
retryCount,
retryLimit,
retryWait);
logger.warn(m, exception);
}
示例7: onGiveup
import org.embulk.spi.util.RetryExecutor; //導入依賴的package包/類
@Override
public void onGiveup(Exception firstException, Exception lastException)
throws RetryExecutor.RetryGiveupException
{
}
示例8: run
import org.embulk.spi.util.RetryExecutor; //導入依賴的package包/類
private <T> T run(Retryable<T> retryable)
{
try {
return re.run(retryable);
}
catch (RetryExecutor.RetryGiveupException e) {
throw new RuntimeException(e);
}
}
示例9: add
import org.embulk.spi.util.RetryExecutor; //導入依賴的package包/類
@Override
public void add(Buffer buffer)
{
try {
// this implementation is for creating file when there is data.
if (o == null) {
o = hdfsClient.create(currentPath, overwrite);
logger.info("Uploading '{}'", currentPath);
}
write(buffer);
}
catch (RetryExecutor.RetryGiveupException e) {
throw new RuntimeException(e);
}
finally {
buffer.release();
}
}