Package com.palantir.async.initializer
Interface CallbackInitializable<R>
-
public interface CallbackInitializable<R>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
initialize(R resource)
default void
onInitializationFailureCleanup(R resource, Throwable initFailure)
If#initialize(R)
failing can result in a state where cleanup is necessary, override this method.default Callback<R>
retryUnlessCleanupThrowsCallback()
Returns a Callback that will retry initialization on failure, unless the cleanup task also throws, in which case the exception thrown by the cleanup task is propagated.default Callback<R>
singleAttemptCallback()
Returns a Callback that runs initialize only once.
-
-
-
Method Detail
-
initialize
void initialize(R resource)
-
onInitializationFailureCleanup
default void onInitializationFailureCleanup(R resource, Throwable initFailure)
If#initialize(R)
failing can result in a state where cleanup is necessary, override this method.- Parameters:
resource
- the resource used in initialization.initFailure
- the Throwable causing the failure in initialization.
-
singleAttemptCallback
default Callback<R> singleAttemptCallback()
Returns a Callback that runs initialize only once. On initialization failure, executes the specified cleanup and then wraps and throws the cause.
-
-