当前位置: 首页>>代码示例>>Java>>正文


Java RetryConstraint类代码示例

本文整理汇总了Java中com.path.android.jobqueue.RetryConstraint的典型用法代码示例。如果您正苦于以下问题:Java RetryConstraint类的具体用法?Java RetryConstraint怎么用?Java RetryConstraint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RetryConstraint类属于com.path.android.jobqueue包,在下文中一共展示了RetryConstraint类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldReRunOnThrowable

import com.path.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
protected RetryConstraint shouldReRunOnThrowable(Throwable throwable, int runCount,
        int maxRunCount) {
    if (shouldRetry(throwable)) {
        // For the purposes of the demo, just back off 250 ms.
        RetryConstraint constraint = RetryConstraint
                .createExponentialBackoff(runCount, 250);
        constraint.setApplyNewDelayToGroup(true);
        return constraint;
    }
    return RetryConstraint.CANCEL;
}
 
开发者ID:yigit,项目名称:dev-summit-architecture-demo,代码行数:13,代码来源:SaveNewPostJob.java

示例2: shouldReRunOnThrowable

import com.path.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
public RetryConstraint shouldReRunOnThrowable(Throwable throwable, int runCount,
        int maxRunCount) {
    if (shouldRetry(throwable)) {
        return RetryConstraint.createExponentialBackoff(runCount, 1000);
    }
    return RetryConstraint.CANCEL;
}
 
开发者ID:yigit,项目名称:dev-summit-architecture-demo,代码行数:9,代码来源:FetchFeedJob.java

示例3: testFailure404

import com.path.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Test
public void testFailure404() throws Throwable {
    FetchFeedJob job = new FetchFeedJob(BaseJob.BACKGROUND, null);
    when(mApiService.feed(0L)).thenReturn(createCall(404, new FeedResponse()));
    job.inject(getTestComponent());
    Throwable exception = safeRun(job);
    assertThat(exception, notNullValue());
    assertThat(exception, instanceOf(NetworkException.class));
    RetryConstraint retryConstraint = job.shouldReRunOnThrowable(exception, 1, 10);
    assertThat(retryConstraint.shouldRetry(), is(false));
}
 
开发者ID:yigit,项目名称:dev-summit-architecture-demo,代码行数:12,代码来源:FetchFeedJobTest.java

示例4: testFailure500

import com.path.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Test
public void testFailure500() throws Throwable {
    FetchFeedJob job = new FetchFeedJob(BaseJob.BACKGROUND, null);
    when(mApiService.feed(0L)).thenReturn(createCall(500, new FeedResponse()));
    job.inject(getTestComponent());
    Throwable exception = safeRun(job);
    assertThat(exception, notNullValue());
    assertThat(exception, instanceOf(NetworkException.class));
    RetryConstraint retryConstraint = job.shouldReRunOnThrowable(exception, 1, 10);
    assertThat(retryConstraint.shouldRetry(), is(true));
}
 
开发者ID:yigit,项目名称:dev-summit-architecture-demo,代码行数:12,代码来源:FetchFeedJobTest.java

示例5: shouldReRunOnThrowable

import com.path.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
protected RetryConstraint shouldReRunOnThrowable(Throwable throwable, int runCount, int maxRunCount) {
    return RetryConstraint.CANCEL;
}
 
开发者ID:CMPUT301W16T15,项目名称:Shareo,代码行数:5,代码来源:UpdateUserJob.java

示例6: shouldReRunOnThrowable

import com.path.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
protected RetryConstraint shouldReRunOnThrowable(Throwable throwable, int runCount, int maxRunCount) {
    return RetryConstraint.RETRY;
}
 
开发者ID:CMPUT301W16T15,项目名称:Shareo,代码行数:5,代码来源:CreateGameJob.java

示例7: shouldReRunOnThrowable

import com.path.android.jobqueue.RetryConstraint; //导入依赖的package包/类
@Override
protected RetryConstraint shouldReRunOnThrowable(Throwable throwable,
                                                 int runCount,
                                                 int maxRunCount) {
    return RetryConstraint.CANCEL;
}
 
开发者ID:GreenSkinMonster,项目名称:hipda,代码行数:7,代码来源:BaseJob.java


注:本文中的com.path.android.jobqueue.RetryConstraint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。