1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.volley;
18
19/**
20 * Retry policy for a request.
21 */
22public interface RetryPolicy {
23
24    /**
25     * Returns the current timeout (used for logging).
26     */
27    public int getCurrentTimeout();
28
29    /**
30     * Returns the current retry count (used for logging).
31     */
32    public int getCurrentRetryCount();
33
34    /**
35     * Prepares for the next retry by applying a backoff to the timeout.
36     * @param error The error code of the last attempt.
37     * @throws VolleyError In the event that the retry could not be performed (for example if we
38     * ran out of attempts), the passed in error is thrown.
39     */
40    public void retry(VolleyError error) throws VolleyError;
41}
42