+str #24812 fix signature of monitor()

* make monitor be a keep.both by default
This commit is contained in:
Konrad Malawski 2018-04-09 11:48:06 +09:00 committed by Patrik Nordwall
parent f06595dd5d
commit f9911facc0
8 changed files with 94 additions and 16 deletions

View file

@ -3189,14 +3189,38 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
def watchTermination[M]()(matF: function.Function2[Mat, CompletionStage[Done], M]): javadsl.Source[Out, M] =
new Source(delegate.watchTermination()((left, right) matF(left, right.toJava)))
/**
* Materializes to `FlowMonitor<Out>` that allows monitoring of the current flow. All events are propagated
* by the monitor unchanged. Note that the monitor inserts a memory barrier every time it processes an
* event, and may therefor affect performance.
* The `combine` function is used to combine the `FlowMonitor` with this flow's materialized value.
*/
@Deprecated
@deprecated("Use monitor() or monitorMat(combine) instead", "2.5.17")
def monitor[M]()(combine: function.Function2[Mat, FlowMonitor[Out], M]): javadsl.Source[Out, M] =
new Source(delegate.monitorMat(combinerToScala(combine)))
/**
* Materializes to `FlowMonitor[Out]` that allows monitoring of the current flow. All events are propagated
* by the monitor unchanged. Note that the monitor inserts a memory barrier every time it processes an
* event, and may therefor affect performance.
* The `combine` function is used to combine the `FlowMonitor` with this flow's materialized value.
*/
def monitor[M]()(combine: function.Function2[Mat, FlowMonitor[Out], M]): javadsl.Source[Out, M] =
new Source(delegate.monitor()(combinerToScala(combine)))
def monitorMat[M](combine: function.Function2[Mat, FlowMonitor[Out], M]): javadsl.Source[Out, M] =
new Source(delegate.monitorMat(combinerToScala(combine)))
/**
* Materializes to `Pair<Mat, FlowMonitor<<Out>>`, which is unlike most other operators (!),
* in which usually the default materialized value keeping semantics is to keep the left value
* (by passing `Keep.left()` to a `*Mat` version of a method). This operator is an exception from
* that rule and keeps both values since dropping its sole purpose is to introduce that materialized value.
*
* The `FlowMonitor` allows monitoring of the current flow. All events are propagated
* by the monitor unchanged. Note that the monitor inserts a memory barrier every time it processes an
* event, and may therefor affect performance.
*/
def monitor(): Source[Out, Pair[Mat, FlowMonitor[Out]]] =
monitorMat(Keep.both)
/**
* Delays the initial element by the specified duration.