1 /* 2 * RetryHandler.java 3 * 4 * Copyright (C) 2021 by RStudio, PBC 5 * 6 * Unless you have received this program directly from RStudio pursuant 7 * to the terms of a commercial license agreement with RStudio, then 8 * this program is licensed to you under the terms of version 3 of the 9 * GNU Affero General Public License. This program is distributed WITHOUT 10 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the 12 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. 13 * 14 */ 15 package org.rstudio.studio.client.server.remote; 16 17 import org.rstudio.core.client.jsonrpc.RpcError; 18 import org.rstudio.core.client.jsonrpc.RpcRequest; 19 20 interface RetryHandler 21 { 22 // perform the retry onRetry()23 void onRetry(); 24 25 // retry the operation with a modified request onModifiedRetry(RpcRequest modifiedRequest)26 void onModifiedRetry(RpcRequest modifiedRequest); 27 28 // will be called with the original error that caused the retry attempt 29 // if there is an error involving the retry mechanism itself (e.g. error 30 // occurs during attempt to authenticate in response to UNAUTHORIZED) onError(RpcError error)31 void onError(RpcError error); 32 } 33