Package com.google.gerrit.server.update
Class RetryHelper
java.lang.Object
com.google.gerrit.server.update.RetryHelper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classOptions for retrying a single operation. -
Constructor Summary
ConstructorsConstructorDescriptionRetryHelper(org.eclipse.jgit.lib.Config cfg, RetryHelper.Metrics metrics, BatchUpdate.Factory updateFactory, com.google.inject.Provider<InternalAccountQuery> internalAccountQuery, com.google.inject.Provider<InternalChangeQuery> internalChangeQuery, com.google.inject.Provider<InternalGroupQuery> internalGroupQuery, PluginSetContext<ExceptionHook> exceptionHooks, Consumer<com.github.rholder.retry.RetryerBuilder<?>> overwriteDefaultRetryerStrategySetup) -
Method Summary
Modifier and TypeMethodDescriptionaccountIndexQuery(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.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.groupIndexQuery(String actionName, RetryableIndexQueryAction.IndexQueryAction<T, InternalGroupQuery> indexQueryAction) Creates an action for querying the group index that is executed with retrying when called.<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 Details
-
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, com.google.inject.Provider<InternalGroupQuery> internalGroupQuery, PluginSetContext<ExceptionHook> exceptionHooks, Consumer<com.github.rholder.retry.RetryerBuilder<?>> overwriteDefaultRetryerStrategySetup)
-
-
Method Details
-
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
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
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
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
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
-
groupIndexQuery
public <T> RetryableIndexQueryAction<InternalGroupQuery,T> groupIndexQuery(String actionName, RetryableIndexQueryAction.IndexQueryAction<T, InternalGroupQuery> indexQueryAction) Creates an action for querying the group index that is executed with retrying when called.The index query action gets a
InternalGroupQueryprovided 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
-
formatCause
-