Package akka.stream
Class SharedKillSwitch
- java.lang.Object
-
- akka.stream.SharedKillSwitch
-
- All Implemented Interfaces:
KillSwitch
public final class SharedKillSwitch extends java.lang.Object implements KillSwitch
After callingshutdown()all materialized, running instances of allGraphs provided by theSharedKillSwitchwill complete their downstreams and cancel their upstreams (unless if finished or failed already in which case the command is ignored). Subsequent invocations ofshutdown()andSharedKillSwitch#abort()will be ignored.
-
-
Constructor Summary
Constructors Constructor Description SharedKillSwitch(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(java.lang.Throwable reason)After callingSharedKillSwitch#abort()all materialized, running instances of allGraphs provided by theSharedKillSwitchwill fail their downstreams with the provided exception and cancel their upstreams (unless it finished or failed already in which case the command is ignored).<T> Graph<FlowShape<T,T>,SharedKillSwitch>flow()Returns a typed Flow of a requested type that will be linked to thisSharedKillSwitchinstance.java.lang.Stringname()voidshutdown()java.lang.StringtoString()
-
-
-
Method Detail
-
abort
public void abort(java.lang.Throwable reason)
After callingSharedKillSwitch#abort()all materialized, running instances of allGraphs provided by theSharedKillSwitchwill fail their downstreams with the provided exception and cancel their upstreams (unless it finished or failed already in which case the command is ignored). Subsequent invocations ofshutdown()andSharedKillSwitch#abort()will be ignored.These provided
Graphs materialize to their owning switch. This might make certain integrations simpler than passing around the switch instance itself.- Specified by:
abortin interfaceKillSwitch- Parameters:
reason- The exception to be used for failing the linkedGraphs
-
flow
public <T> Graph<FlowShape<T,T>,SharedKillSwitch> flow()
Returns a typed Flow of a requested type that will be linked to thisSharedKillSwitchinstance. By invokingshutdown()orSharedKillSwitch#abort()all running instances of all providedGraphs by this switch will be stopped normally or failed.- Returns:
- A reusable
Graphthat is linked with the switch. The materialized value provided is this switch itself.
-
name
public java.lang.String name()
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceKillSwitch
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-