Skip to content
This repository was archived by the owner on Mar 2, 2022. It is now read-only.

Commit 355ea75

Browse files
committed
Use default values for ConnectableSFlux.autoConnect to reduce the number of functions
1 parent 2257c75 commit 355ea75

File tree

1 file changed

+4
-30
lines changed

1 file changed

+4
-30
lines changed

src/main/scala/reactor/core/scala/publisher/ConnectableSFlux.scala

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,21 @@ import scala.concurrent.duration.Duration
88

99
class ConnectableSFlux[T]private(private val connectableFlux: ConnectableFlux[T]) extends SFlux[T] {
1010

11-
/**
12-
* Connects this [[ConnectableSFlux]] to the upstream source when the first [[org.reactivestreams.Subscriber]]
13-
* subscribes.
14-
*
15-
* <p>
16-
* <img class="marble" src="https://raw.githubusercontent.com/reactor/reactor-core/v3.0.6.RELEASE/src/docs/marble/autoconnect.png" alt="">
17-
*
18-
* @return a [[SFlux]] that connects to the upstream source when the first [[org.reactivestreams.Subscriber]] subscribes
19-
*/
20-
final def autoConnect(): SFlux[T] = SFlux.fromPublisher(connectableFlux.autoConnect())
21-
22-
/**
23-
* Connects this [[ConnectableSFlux]] to the upstream source when the specified amount of
24-
* [[org.reactivestreams.Subscriber]] subscribes.
25-
* <p>
26-
* Subscribing and immediately unsubscribing Subscribers also contribute the the subscription count
27-
* that triggers the connection.
28-
*
29-
* <p>
30-
* <img class="marble" src="https://raw.githubusercontent.com/reactor/reactor-core/v3.0.6.RELEASE/src/docs/marble/autoconnect.png" alt="">
31-
*
32-
* @param minSubscribers the minimum number of subscribers
33-
* @return a [[SFlux]] that connects to the upstream source when the given amount of Subscribers subscribe
34-
*/
35-
final def autoConnect(minSubscribers: Int): SFlux[T] = SFlux.fromPublisher(connectableFlux.autoConnect(minSubscribers))
36-
3711
/**
3812
* Connects this [[ConnectableSFlux]] to the upstream source when the specified amount of
3913
* [[org.reactivestreams.Subscriber]] subscribes and calls the supplied consumer with a runnable that allows disconnecting.
4014
*
41-
* @param minSubscribers the minimum number of subscribers
42-
* @param cancelSupport the consumer that will receive the [[Disposable]] that allows disconnecting
15+
* @param minSubscribers the minimum number of subscribers. Default is 1
16+
* @param cancelSupport the consumer that will receive the [[Disposable]] that allows disconnecting. Default is do nothing
4317
*
4418
* <p>
4519
* <img class="marble" src="https://raw.githubusercontent.com/reactor/reactor-core/v3.0.6.RELEASE/src/docs/marble/autoconnect.png" alt="">
4620
* @return a { @link Flux} that connects to the upstream source when the given amount of subscribers subscribed
4721
*/
48-
final def autoConnect(minSubscribers: Int, cancelSupport: Disposable => Unit): SFlux[T] = SFlux.fromPublisher(connectableFlux.autoConnect(minSubscribers, cancelSupport))
22+
final def autoConnect(minSubscribers: Int = 1, cancelSupport: Disposable => Unit = _ => ()): SFlux[T] = SFlux.fromPublisher(connectableFlux.autoConnect(minSubscribers, cancelSupport))
4923

5024
/**
51-
* Connect this [[ConnectableSFlux]] to its source and return a [[Runnable]] that
25+
* Connect this [[ConnectableSFlux]] to its source and return a [[Disposable]] that
5226
* can be used for disconnecting.
5327
*
5428
* @return the [[Disposable]] that allows disconnecting the connection after.

0 commit comments

Comments
 (0)