本文整理汇总了Java中com.couchbase.client.java.error.TemporaryFailureException类的典型用法代码示例。如果您正苦于以下问题:Java TemporaryFailureException类的具体用法?Java TemporaryFailureException怎么用?Java TemporaryFailureException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TemporaryFailureException类属于com.couchbase.client.java.error包,在下文中一共展示了TemporaryFailureException类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retryStrategy
import com.couchbase.client.java.error.TemporaryFailureException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static RetryWhenFunction retryStrategy() {
return RetryBuilder
.anyOf(TemporaryFailureException.class, RequestCancelledException.class, BackpressureException.class)
.delay(Delay.exponential(TimeUnit.MILLISECONDS, 100))
.max(3)
.build();
}
示例2: call
import com.couchbase.client.java.error.TemporaryFailureException; //导入依赖的package包/类
@Override
public Observable<? extends Document> call(Document doc) {
return asyncBucket
.upsert(doc)
.timeout(importTimeout, TimeUnit.MILLISECONDS)
.retryWhen(
RetryBuilder
.anyOf(RequestCancelledException.class)
.delay(fixed(requestCancelledExceptionDelay,
TimeUnit.MILLISECONDS))
.max(requestCancelledExceptionRetries).build())
.retryWhen(
RetryBuilder
.anyOf(TemporaryFailureException.class,
BackpressureException.class)
.delay(fixed(temporaryFailureExceptionDelay,
TimeUnit.MILLISECONDS))
.max(temporaryFailureExceptionRetries).build())
.doOnError(t -> writeToErrorLog(doc.id()))
.doOnNext(jd -> writeToSuccessLog(doc.id()))
.onErrorResumeNext(
new Func1<Throwable, Observable<Document>>() {
@Override
public Observable<Document> call(Throwable throwable) {
log.error(String.format(
"Could not import document ", doc.id()));
log.error(throwable);
return Observable.empty();
}
});
}