-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add take(int, boolean), prep for new default behavior in 3.5 (#2691)
This commit introduces the `take(int, boolean)` operator, which can explicitly behave either like current `take(int)` (with `limitRequest` set to `false`) or like `limitRequest(int)` (with `limitRequest` set to `true`). `take(int)` becomes an alias for it, and `take(n, false)` is the new canonical way of obtaining the current take behavior (unbounded upstream request, cancels when enough elements have been emitted). This is because the behavior of `take(n)` is scheduled to change in 3.5 to still cancel whenever enough elements have been emitted, but limit the upstream request to what is strictly necessary. This is the behavior currently obtained through `limitRequest(int)` but that is confusing to most users, who expect `take` to behave like that by default. As a result, `limitRequest` is deprecated in favor of `take(n, true)` for the remainder of the 3.4.x line, and will be ultimately replaceable by `take(n)` in 3.5 and above. It is expected that most usages should see the behavior change in 3.5 as transparent, but `take(int, boolean)` has the benefit of being totally explicit... See #2690 for 3.5.0 planned changes. Fixes #2339.
- Loading branch information
1 parent
f383f4d
commit dedac83
Showing
7 changed files
with
238 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
...rc/main/java/reactor/core/publisher/doc-files/marbles/takeLimitRequestFalse.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.