final class SharedKillSwitch extends KillSwitch
A SharedKillSwitch is a provider for Graphs of FlowShape that can be completed or failed from the outside. A Graph returned by the switch can be materialized arbitrary amount of times: every newly materialized Graph belongs to the switch from which it was acquired. Multiple SharedKillSwitch instances are isolated from each other, shutting down or aborting on instance does not affect the Graphs provided by another instance.
After calling SharedKillSwitch#shutdown all materialized, running instances of all Graphs provided by the SharedKillSwitch will complete their downstreams and cancel their upstreams (unless if finished or failed already in which case the command is ignored). Subsequent invocations of SharedKillSwitch#shutdown and SharedKillSwitch#abort will be ignored.
After calling SharedKillSwitch#abort all materialized, running instances of all Graphs provided by the SharedKillSwitch will 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 of SharedKillSwitch#shutdown and SharedKillSwitch#abort will be ignored.
The Graphs provided by the SharedKillSwitch do not modify the passed through elements in any way or affect backpressure in the stream. All provided Graphs provide the parent SharedKillSwitch as materialized value.
This class is thread-safe, the instance can be passed safely among threads and its methods may be invoked concurrently.
- Source
- KillSwitch.scala
- Alphabetic
- By Inheritance
- SharedKillSwitch
- KillSwitch
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Value Members
- def abort(reason: Throwable): Unit
After calling SharedKillSwitch#abort all materialized, running instances of all Graphs provided by the SharedKillSwitch will fail their downstreams with the provided exception and cancel their upstreams (unless it finished or failed already in which case the command is ignored).
After calling SharedKillSwitch#abort all materialized, running instances of all Graphs provided by the SharedKillSwitch will 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 of SharedKillSwitch#shutdown and SharedKillSwitch#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.
- reason
The exception to be used for failing the linked Graphs
- Definition Classes
- SharedKillSwitch → KillSwitch
- def flow[T]: Graph[FlowShape[T, T], SharedKillSwitch]
Returns a typed Flow of a requested type that will be linked to this SharedKillSwitch instance.
Returns a typed Flow of a requested type that will be linked to this SharedKillSwitch instance. By invoking SharedKillSwitch#shutdown or SharedKillSwitch#abort all running instances of all provided Graphs by this switch will be stopped normally or failed.
- T
Type of the elements the Flow will forward
- returns
A reusable Graph that is linked with the switch. The materialized value provided is this switch itself.
- val name: String
- def shutdown(): Unit
After calling SharedKillSwitch#shutdown all materialized, running instances of all Graphs provided by the SharedKillSwitch will complete their downstreams and cancel their upstreams (unless if finished or failed already in which case the command is ignored).
After calling SharedKillSwitch#shutdown all materialized, running instances of all Graphs provided by the SharedKillSwitch will complete their downstreams and cancel their upstreams (unless if finished or failed already in which case the command is ignored). Subsequent invocations of SharedKillSwitch#shutdown and SharedKillSwitch#abort will be ignored.
- Definition Classes
- SharedKillSwitch → KillSwitch
- def toString(): String
- Definition Classes
- SharedKillSwitch → AnyRef → Any