R
- the return type of produced StatefulRetryHandler
which equals to the return type of
target-method which is executed by circuit breaker.public class ReusableRetryHandler<R> extends Object implements OnePerExecutionHandlerFactory<R>
BreakHandler
which creates single instance of StatefulRetryHandler
per
execution context. Created instance is later reused for handling subsequent retry calls in current execution context.
The instance is bound to current ExecutionContext. This means that "one and only one" instance of
StatefulRetryHandler
will be crated per execution of a Task, no matter how many times circuit breaker will
try to call target method again.
Constructor and Description |
---|
ReusableRetryHandler(int maxNumberOfAttempts) |
Modifier and Type | Method and Description |
---|---|
BreakHandler<R> |
createNewHandler(Task<R> task,
ExecutionContext<R> executionContext)
Constructs and returns new
BreakHandler . |
String |
getOnePerExecutionContextParamName(Task<R> task,
ExecutionContext<R> executionContext)
Returns execution context parameter name under which produced break handler will be stored.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
makeHandler
onBreak
public BreakHandler<R> createNewHandler(Task<R> task, ExecutionContext<R> executionContext)
OnePerExecutionHandlerFactory
BreakHandler
. This method is invoked break handler has not yet been created in
current execution context.createNewHandler
in interface OnePerExecutionHandlerFactory<R>
task
- the originally executed taskexecutionContext
- current execution contextBreakHandler
public String getOnePerExecutionContextParamName(Task<R> task, ExecutionContext<R> executionContext)
OnePerExecutionHandlerFactory
getOnePerExecutionContextParamName
in interface OnePerExecutionHandlerFactory<R>
task
- the originally executed taskexecutionContext
- current execution contextExecutionContext.getContextAttribute(String)
Copyright © 2017. All rights reserved.