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