本文整理汇总了Java中org.springframework.retry.backoff.BackOffContext类的典型用法代码示例。如果您正苦于以下问题:Java BackOffContext类的具体用法?Java BackOffContext怎么用?Java BackOffContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BackOffContext类属于org.springframework.retry.backoff包,在下文中一共展示了BackOffContext类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.springframework.retry.backoff.BackOffContext; //导入依赖的package包/类
@Override
public BackOffContext start(RetryContext retryContext) {
return new BackOffContext() {
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
};
}
示例2: testBackOffPolicyIsExponential
import org.springframework.retry.backoff.BackOffContext; //导入依赖的package包/类
@Test
public void testBackOffPolicyIsExponential()
{
List<Long> sleeps = newArrayList();
ExponentialBackOffPolicy fakeBackOff = this.backOffPolicy.withSleeper(sleeps::add);
BackOffContext context = fakeBackOff.start(null);
for (int i = 0; i < 11; i++)
{
fakeBackOff.backOff(context);
}
assertEquals(sleeps,
Arrays.asList(1000L, 2000L, 4000L, 8000L, 16000L, 32000L, 64000L, 128000L, 256000L, 300000L, 300000L));
}
示例3: backOff
import org.springframework.retry.backoff.BackOffContext; //导入依赖的package包/类
@Override
public void backOff(BackOffContext backOffContext) throws BackOffInterruptedException {
backoffAttempts++;
}
示例4: start
import org.springframework.retry.backoff.BackOffContext; //导入依赖的package包/类
@Override
public BackOffContext start(RetryContext retryContext) {
return null;
}
示例5: backOff
import org.springframework.retry.backoff.BackOffContext; //导入依赖的package包/类
@Override
public void backOff(BackOffContext backOffContext) throws BackOffInterruptedException {
count++;
}