• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2023 The gRPC Authors
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 
17 package io.grpc.internal;
18 
19 /**
20  * This interface is used to schedule future retry attempts for a failed operation. The retry delay
21  * and the number of attempt is defined by implementing classes. Implementations should assure
22  * that only one future retry operation is ever scheduled at a time.
23  */
24 public interface RetryScheduler {
25 
26   /**
27    * A request to schedule a future retry (or retries) for a failed operation. Noop if an operation
28    * has already been scheduled.
29    */
schedule(Runnable retryOperation)30   void schedule(Runnable retryOperation);
31 
32   /**
33    * Resets the scheduler, effectively cancelling any future retry operation.
34    */
reset()35   void reset();
36 }
37