本文整理汇总了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();
}
}