Package com.google.gerrit.server.update
Class RetryHelper
- java.lang.Object
-
- com.google.gerrit.server.update.RetryHelper
-
public class RetryHelper extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRetryHelper.Metricsstatic classRetryHelper.OptionsOptions for retrying a single operation.
-
Constructor Summary
Constructors Constructor Description RetryHelper(org.eclipse.jgit.lib.Config cfg, RetryHelper.Metrics metrics, BatchUpdate.Factory updateFactory, com.google.inject.Provider<InternalAccountQuery> internalAccountQuery, com.google.inject.Provider<InternalChangeQuery> internalChangeQuery, PluginSetContext<ExceptionHook> exceptionHooks, Consumer<com.github.rholder.retry.RetryerBuilder<?>> overwriteDefaultRetryerStrategySetup)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> RetryableIndexQueryAction<InternalAccountQuery,T>accountIndexQuery(String actionName, RetryableIndexQueryAction.IndexQueryAction<T,InternalAccountQuery> indexQueryAction)Creates an action for querying the account index that is executed with retrying when called.<T> RetryableAction<T>accountUpdate(String actionName, RetryableAction.Action<T> action)Creates an action for updating an account that is executed with retrying when called.<T> RetryableAction<T>action(RetryableAction.ActionType actionType, String actionName, RetryableAction.Action<T> action)Creates an action that is executed with retrying when called.<T> RetryableAction<T>action(String actionType, String actionName, RetryableAction.Action<T> action)Creates an action that is executed with retrying when called.<T> RetryableIndexQueryAction<InternalChangeQuery,T>changeIndexQuery(String actionName, RetryableIndexQueryAction.IndexQueryAction<T,InternalChangeQuery> indexQueryAction)Creates an action for querying the change index that is executed with retrying when called.<T> RetryableAction<T>changeUpdate(String actionName, RetryableAction.Action<T> action)Creates an action for updating a change that is executed with retrying when called.<T> RetryableChangeAction<T>changeUpdate(String actionName, RetryableChangeAction.ChangeAction<T> changeAction)Creates an action for updating a change that is executed with retrying when called.StringformatCause(Throwable t)<T> RetryableAction<T>groupUpdate(String actionName, RetryableAction.Action<T> action)Creates an action for updating a group that is executed with retrying when called.static RetryHelper.Options.Builderoptions()<T> RetryableAction<T>pluginUpdate(String actionName, RetryableAction.Action<T> action)Creates an action for updating of plugin-specific data that is executed with retrying when called.
-
-
-
Constructor Detail
-
RetryHelper
public RetryHelper(org.eclipse.jgit.lib.Config cfg, RetryHelper.Metrics metrics, BatchUpdate.Factory updateFactory, com.google.inject.Provider<InternalAccountQuery> internalAccountQuery, com.google.inject.Provider<InternalChangeQuery> internalChangeQuery, PluginSetContext<ExceptionHook> exceptionHooks, Consumer<com.github.rholder.retry.RetryerBuilder<?>> overwriteDefaultRetryerStrategySetup)
-
-
Method Detail
-
options
public static RetryHelper.Options.Builder options()
-
action
public <T> RetryableAction<T> action(String actionType, String actionName, RetryableAction.Action<T> action)
Creates an action that is executed with retrying when called.This method allows to use a custom action type. If the action type is one of
RetryableAction.ActionTypethe usage ofaction(ActionType, String, Action)is preferred.The action type is used as metric bucket and decides which default timeout is used.
- Parameters:
actionType- the type of the action, used as metric bucketactionName- the name of the action, used as metric bucketaction- the action that should be executed- Returns:
- the retryable action, callers need to call
RetryableAction.call()to execute the action
-
action
public <T> RetryableAction<T> action(RetryableAction.ActionType actionType, String actionName, RetryableAction.Action<T> action)
Creates an action that is executed with retrying when called.- Parameters:
actionType- the type of the action, used as metric bucketactionName- the name of the action, used as metric bucketaction- the action that should be executed- Returns:
- the retryable action, callers need to call
RetryableAction.call()to execute the action
-
accountUpdate
public <T> RetryableAction<T> accountUpdate(String actionName, RetryableAction.Action<T> action)
Creates an action for updating an account that is executed with retrying when called.- Parameters:
actionName- the name of the action, used as metric bucketaction- the action that should be executed- Returns:
- the retryable action, callers need to call
RetryableAction.call()to execute the action
-
changeUpdate
public <T> RetryableAction<T> changeUpdate(String actionName, RetryableAction.Action<T> action)
Creates an action for updating a change that is executed with retrying when called.- Parameters:
actionName- the name of the action, used as metric bucketaction- the action that should be executed- Returns:
- the retryable action, callers need to call
RetryableAction.call()to execute the action
-
changeUpdate
public <T> RetryableChangeAction<T> changeUpdate(String actionName, RetryableChangeAction.ChangeAction<T> changeAction)
Creates an action for updating a change that is executed with retrying when called.The change action gets a
BatchUpdate.Factoryprovided that can be used to update the change.- Parameters:
actionName- the name of the action, used as metric bucketchangeAction- the action that should be executed- Returns:
- the retryable action, callers need to call
RetryableChangeAction.call()to execute the action
-
groupUpdate
public <T> RetryableAction<T> groupUpdate(String actionName, RetryableAction.Action<T> action)
Creates an action for updating a group that is executed with retrying when called.- Parameters:
actionName- the name of the action, used as metric bucketaction- the action that should be executed- Returns:
- the retryable action, callers need to call
RetryableAction.call()to execute the action
-
pluginUpdate
public <T> RetryableAction<T> pluginUpdate(String actionName, RetryableAction.Action<T> action)
Creates an action for updating of plugin-specific data that is executed with retrying when called.- Parameters:
actionName- the name of the action, used as metric bucketaction- the action that should be executed- Returns:
- the retryable action, callers need to call
RetryableAction.call()to execute the action
-
accountIndexQuery
public <T> RetryableIndexQueryAction<InternalAccountQuery,T> accountIndexQuery(String actionName, RetryableIndexQueryAction.IndexQueryAction<T,InternalAccountQuery> indexQueryAction)
Creates an action for querying the account index that is executed with retrying when called.The index query action gets a
InternalAccountQueryprovided that can be used to query the account index.- Parameters:
actionName- the name of the action, used as metric bucketindexQueryAction- the action that should be executed- Returns:
- the retryable action, callers need to call
RetryableIndexQueryAction.call()to execute the action
-
changeIndexQuery
public <T> RetryableIndexQueryAction<InternalChangeQuery,T> changeIndexQuery(String actionName, RetryableIndexQueryAction.IndexQueryAction<T,InternalChangeQuery> indexQueryAction)
Creates an action for querying the change index that is executed with retrying when called.The index query action gets a
InternalChangeQueryprovided that can be used to query the change index.- Parameters:
actionName- the name of the action, used as metric bucketindexQueryAction- the action that should be executed- Returns:
- the retryable action, callers need to call
RetryableIndexQueryAction.call()to execute the action
-
-