Package net.snowflake.client.jdbc
Class RetryContextManager
- java.lang.Object
-
- net.snowflake.client.jdbc.RetryContextManager
-
@SnowflakeJdbcInternalApi public class RetryContextManager extends Object
RetryContextManager lets you register logic (as callbacks) that will be re-executed during a retry of a request.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRetryContextManager.RetryHookEnumeration for different retry hook strategies.
-
Constructor Summary
Constructors Constructor Description RetryContextManager()Default constructor using ALWAYS_BEFORE_RETRY as the default retry hook.RetryContextManager(RetryContextManager.RetryHook retryHook)Constructor that accepts a specific RetryHook.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecuteRetryCallbacks(org.apache.http.client.methods.HttpRequestBase requestToRetry)Executes all registered retry callbacks in the order they were added, before reattempting the operation.RetryContextgetRetryContext()RetryContextManager.RetryHookgetRetryHook()Returns the configured RetryHook.RetryContextManagerregisterRetryCallback(ThrowingBiFunction<org.apache.http.client.methods.HttpRequestBase,RetryContext,RetryContext,SnowflakeSQLException> callback)Registers a retry callback that will be executed on each retry.
-
-
-
Constructor Detail
-
RetryContextManager
public RetryContextManager()
Default constructor using ALWAYS_BEFORE_RETRY as the default retry hook.
-
RetryContextManager
public RetryContextManager(RetryContextManager.RetryHook retryHook)
Constructor that accepts a specific RetryHook.- Parameters:
retryHook- the retry hook strategy.
-
-
Method Detail
-
registerRetryCallback
public RetryContextManager registerRetryCallback(ThrowingBiFunction<org.apache.http.client.methods.HttpRequestBase,RetryContext,RetryContext,SnowflakeSQLException> callback)
Registers a retry callback that will be executed on each retry.- Parameters:
callback- A RetryCallback encapsulating the logic to be replayed on retry.- Returns:
- the current instance for fluent chaining.
-
executeRetryCallbacks
public void executeRetryCallbacks(org.apache.http.client.methods.HttpRequestBase requestToRetry) throws SnowflakeSQLExceptionExecutes all registered retry callbacks in the order they were added, before reattempting the operation.- Parameters:
requestToRetry- the HTTP request to retry.- Throws:
SnowflakeSQLException- if an error occurs during callback execution.
-
getRetryHook
public RetryContextManager.RetryHook getRetryHook()
Returns the configured RetryHook.- Returns:
- the retry hook.
-
getRetryContext
public RetryContext getRetryContext()
-
-