本文整理汇总了Java中com.birbit.android.jobqueue.RetryConstraint类的典型用法代码示例。如果您正苦于以下问题:Java RetryConstraint类的具体用法?Java RetryConstraint怎么用?Java RetryConstraint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RetryConstraint类属于com.birbit.android.jobqueue包,在下文中一共展示了RetryConstraint类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldReRunOnThrowable
import com.birbit.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
protected RetryConstraint shouldReRunOnThrowable(Throwable throwable, int runCount,
int maxRunCount) {
// An error occurred in onRun.
// Return value determines whether this job should retry or cancel. You can further
// specify a backoff strategy or change the job's priority. You can also apply the
// delay to the whole group to preserve jobs' running order.
return RetryConstraint.RETRY;
}
示例2: shouldReRunOnThrowable
import com.birbit.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
protected RetryConstraint shouldReRunOnThrowable(@NonNull Throwable throwable, int runCount, int maxRunCount) {
if(throwable instanceof RemoteException) {
RemoteException exception = (RemoteException) throwable;
int statusCode = exception.getResponse().code();
if (statusCode >= 400 && statusCode < 500) {
return RetryConstraint.CANCEL;
}
}
// if we are here, most likely the connection was lost during job execution
return RetryConstraint.RETRY;
}
示例3: shouldReRunOnThrowable
import com.birbit.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
protected RetryConstraint shouldReRunOnThrowable(Throwable throwable, int runCount, int maxRunCount) {
retry++;
if(retry<MAX_RETRY) {
return RetryConstraint.createExponentialBackoff(runCount, 1000);
}else{
return RetryConstraint.CANCEL;
}
}
示例4: shouldReRunOnThrowable
import com.birbit.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
protected RetryConstraint shouldReRunOnThrowable(@NonNull Throwable throwable, int runCount, int maxRunCount) {
if (throwable instanceof ErrorRequestException) {
ErrorRequestException error = (ErrorRequestException) throwable;
int statusCode = error.getResponse().raw().code();
if (statusCode >= 400 && statusCode < 500) {
return RetryConstraint.CANCEL;
}
}
return RetryConstraint.RETRY;
}
示例5: shouldReRunOnThrowable
import com.birbit.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
protected RetryConstraint shouldReRunOnThrowable(@NonNull Throwable throwable, int runCount, int maxRunCount) {
return null;
}
示例6: shouldReRunOnThrowable
import com.birbit.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
protected RetryConstraint shouldReRunOnThrowable(@NonNull Throwable throwable, int runCount, int maxRunCount) {
return RetryConstraint.createExponentialBackoff(runCount, 1000);
}
示例7: shouldReRunOnThrowable
import com.birbit.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
protected RetryConstraint shouldReRunOnThrowable(@NonNull final Throwable poThrowable, final int piRunCount, final int piMaxRunCount) {
return null;
}
示例8: shouldReRunOnThrowable
import com.birbit.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
protected RetryConstraint shouldReRunOnThrowable(Throwable throwable, int runCount, int maxRunCount) {
return RetryConstraint.createExponentialBackoff(runCount, 1000);
}
示例9: shouldReRunOnThrowable
import com.birbit.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
protected RetryConstraint shouldReRunOnThrowable(Throwable throwable, int runCount, int maxRunCount) {
return RetryConstraint.createExponentialBackoff(runCount, 0);
}