public final class UniqueKillSwitch extends java.lang.Object implements KillSwitch
UniqueKillSwitch
is always a result of a materialization (unlike SharedKillSwitch
which is constructed
before any materialization) and it always controls that graph and stage which yielded the materialized value.
After calling shutdown()
the running instance of the Graph
of FlowShape
that materialized to the
UniqueKillSwitch
will complete its downstream and cancel its upstream (unless if finished or failed already in which
case the command is ignored). Subsequent invocations of completion commands will be ignored.
After calling UniqueKillSwitch#abort()
the running instance of the Graph
of FlowShape
that materialized to the
UniqueKillSwitch
will fail its downstream with the provided exception and cancel its upstream
(unless if finished or failed already in which case the command is ignored). Subsequent invocations of
completion commands will be ignored.
It is also possible to individually cancel, complete or fail upstream and downstream parts by calling the corresponding methods.
Constructor and Description |
---|
UniqueKillSwitch(scala.concurrent.Promise<Done> promise) |
Modifier and Type | Method and Description |
---|---|
void |
abort(java.lang.Throwable ex)
After calling
UniqueKillSwitch#abort() the running instance of the Graph of FlowShape that materialized to the
UniqueKillSwitch will fail its downstream with the provided exception and cancel its upstream
(unless if finished or failed already in which case the command is ignored). |
void |
shutdown()
After calling
shutdown() the running instance of the Graph of FlowShape that materialized to the
UniqueKillSwitch will complete its downstream and cancel its upstream (unless if finished or failed already in which
case the command is ignored). |
java.lang.String |
toString() |
public UniqueKillSwitch(scala.concurrent.Promise<Done> promise)
public void shutdown()
shutdown()
the running instance of the Graph
of FlowShape
that materialized to the
UniqueKillSwitch
will complete its downstream and cancel its upstream (unless if finished or failed already in which
case the command is ignored). Subsequent invocations of completion commands will be ignored.shutdown
in interface KillSwitch
public void abort(java.lang.Throwable ex)
UniqueKillSwitch#abort()
the running instance of the Graph
of FlowShape
that materialized to the
UniqueKillSwitch
will fail its downstream with the provided exception and cancel its upstream
(unless if finished or failed already in which case the command is ignored). Subsequent invocations of
completion commands will be ignored.abort
in interface KillSwitch
ex
- (undocumented)public java.lang.String toString()
toString
in class java.lang.Object