當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。