public class RetryStorageOperation extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
RetryStorageOperation.Operation
An operation to be retried
|
static interface |
RetryStorageOperation.RepeatOperation<Ex extends Throwable>
An action that may fail because of expired credentials.
|
Modifier and Type | Field and Description |
---|---|
static int |
MAX_REMOTE_CREDENTIAL_EXPIRED_RETRIES |
Constructor and Description |
---|
RetryStorageOperation() |
Modifier and Type | Method and Description |
---|---|
static <Ex extends Throwable> |
performRequestWithReinitCredentials(RetryStorageOperation.RepeatOperation<Ex> a) |
static <Ex extends Throwable> |
performRequestWithReinitCredentials(RetryStorageOperation.RepeatOperation<Ex> a,
int retries)
Keeps performing actions until credentials expire.
|
static void |
performRequestWithRetry(com.google.jenkins.plugins.util.Executor executor,
RetryStorageOperation.Operation a,
int attempts)
Perform the given operation retrying on error.
|
public static final int MAX_REMOTE_CREDENTIAL_EXPIRED_RETRIES
public static void performRequestWithRetry(com.google.jenkins.plugins.util.Executor executor, RetryStorageOperation.Operation a, int attempts) throws IOException, InterruptedException, com.google.jenkins.plugins.util.ExecutorException
executor
- The executor to use for the operationa
- The operation to execute.attempts
- How many attempts to make. Must be at least 1.IOException
- If performing the operation threw an IOException.InterruptedException
- If performing the operation threw an InterruptedException.com.google.jenkins.plugins.util.ExecutorException
- If the executor threw an exception while performing the operation.public static <Ex extends Throwable> void performRequestWithReinitCredentials(RetryStorageOperation.RepeatOperation<Ex> a, int retries) throws IOException, InterruptedException, com.google.jenkins.plugins.util.ExecutorException, Ex extends Throwable
HttpResponseException with the code Unauthorized is caught. Any other exceptions are passed through.
Ex
- An action-specific exception that might be throwns.a
- Operation to executeretries
- How many times to attempt to refresh credentials if there is no progress. (Every
time an action successfully completes, the retry budget is reset)IOException
- If performing the operation threw an IOException.InterruptedException
- If performing the operation threw an InterruptedException.com.google.jenkins.plugins.util.ExecutorException
- If the executor threw an exception while performing the operation.Ex
- Custom exception thrown by the RetryStorageOperation.Operation
.Ex extends Throwable
public static <Ex extends Throwable> void performRequestWithReinitCredentials(RetryStorageOperation.RepeatOperation<Ex> a) throws IOException, InterruptedException, com.google.jenkins.plugins.util.ExecutorException, Ex extends Throwable
IOException
InterruptedException
com.google.jenkins.plugins.util.ExecutorException
Ex extends Throwable
Copyright © 2016–2019. All rights reserved.