public class DeciderBuilder
extends java.lang.Object
Actor.supervisorStrategy()
.
*
Inside an actor you can use it like this with Java 8 to define your supervisorStrategy.
Example:
@Override private static SupervisorStrategy strategy = new OneForOneStrategy(10, Duration.create("1 minute"), DeciderBuilder. match(ArithmeticException.class, e -> resume()). match(NullPointerException.class, e -> restart()). match(IllegalArgumentException.class, e -> stop()). matchAny(o -> escalate()).build()); @Override public SupervisorStrategy supervisorStrategy() { return strategy; }This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.
Modifier and Type | Method and Description |
---|---|
static <P extends java.lang.Throwable> |
match(java.lang.Class<P> type,
FI.Apply<P,SupervisorStrategy.Directive> apply)
Return a new
PFBuilder with a case statement added. |
static <P extends java.lang.Throwable> |
match(java.lang.Class<P> type,
FI.TypedPredicate<P> predicate,
FI.Apply<P,SupervisorStrategy.Directive> apply)
Return a new
PFBuilder with a case statement added. |
static PFBuilder<java.lang.Throwable,SupervisorStrategy.Directive> |
matchAny(FI.Apply<java.lang.Throwable,SupervisorStrategy.Directive> apply)
Return a new
PFBuilder with a case statement added. |
public static <P extends java.lang.Throwable> PFBuilder<java.lang.Throwable,SupervisorStrategy.Directive> match(java.lang.Class<P> type, FI.Apply<P,SupervisorStrategy.Directive> apply)
PFBuilder
with a case statement added.type
- a type to match the argument againstapply
- an action to apply to the argument if the type matchespublic static <P extends java.lang.Throwable> PFBuilder<java.lang.Throwable,SupervisorStrategy.Directive> match(java.lang.Class<P> type, FI.TypedPredicate<P> predicate, FI.Apply<P,SupervisorStrategy.Directive> apply)
PFBuilder
with a case statement added.type
- a type to match the argument againstpredicate
- a predicate that will be evaluated on the argument if the type matchesapply
- an action to apply to the argument if the type matches and the predicate returns truepublic static PFBuilder<java.lang.Throwable,SupervisorStrategy.Directive> matchAny(FI.Apply<java.lang.Throwable,SupervisorStrategy.Directive> apply)
PFBuilder
with a case statement added.apply
- an action to apply to the argument