Age | Commit message (Collapse) | Author |
|
for error-prone offer, poll and receiveOrNull
Fixes #974
|
|
* Merge onStartInternal and onStart to reduce the number of methods and make code a bit simpler
* Rework initParentJob
* Always establish a parent-child relationship when creating a subclass of AbstractCoroutine. That's our own internal class that we have full control of and it never has a chance to leak to the user-code (so cancellation handlers will be installed etc.). Force implementors of AbstractCoroutine deliberately choose whether parent-child relationship should be established
* As a consequence, get rid of parentContext in all our coroutine classes that are not ScopeCoroutine
* Remove some dead code
* Get rid of an additional parent field from ScopeCoroutine
Leverage already presented information in our implementation, just expose it via an already present internal interface
|
|
They were deprecated long time ago and were removed in Gradle 7
|
|
|
|
|
|
|
|
* Gracefully increase deprecation level on Channel operators instead of removing them, a warning was not strict enough
* Remove hidden onCompletion from -M release
* Promote StateFlow and SharedFlow to stable API
* Lift out experimentality where it is applicable
* CoroutineDispatcher.invoke
* ReceiveChannel.consume and ReceiveChannel.consumeEach
* Flow core operators: onStart, onCompletion, onEmpty
* CompletableDeferred.completeWith
* awaitCancellation
* Add experimentality notes where applicable
|
|
Fixes #2104
Fixes #2299
Co-authored-by: Louis CAD <louis.cognault@gmail.com>
|
|
* Introduce SharedFlow and sharing operators
Summary of changes:
* SharedFlow, MutableSharedFlow and its constructor.
* StateFlow implements SharedFlow.
* SharedFlow.onSubscription operator, clarified docs in other onXxx operators.
* BufferOverflow strategy in kotlinx.coroutines.channels package.
* shareIn and stateIn operators and SharingStarted strategies for them.
* SharedFlow.flowOn error lint (up from StateFlow).
* Precise cancellable() operator fusion.
* Precise distinctUntilChanged() operator fusion.
* StateFlow.compareAndSet function.
* asStateFlow and asSharedFlow read-only view functions.
* Consistently clarified docs on cold vs hot flows.
* Future deprecation notice for BroadcastChannel, ConflatedBroadcastChannel, broadcast, and broadcastIn.
* Channel(...) constructor function has onBufferOverflow parameter.
* buffer(...) operator has onBufferOverflow parameter.
* shareIn/stateIn buffer and overflow strategy are configured via upstream buffer operators.
* shareIn/stateIn fuse with upstream flowOn for more efficient execution.
* conflate() is implemented as buffer(onBufferOverflow=KEEP_LATEST), non-suspending strategies are reasonably supported with 0 and default capacities.
* Added reactive operator migration hints.
* WhileSubscribed with kotlin.time.Duration params
Fixes #2034
Fixes #2047
Co-authored-by: Ibraheem Zaman <1zaman@users.noreply.github.com>
Co-authored-by: Thomas Vos <thomasjsvos@gmail.com>
Co-authored-by: Travis Wyatt <travis.i.wyatt@gmail.com>
|
|
This is a problematic for Android when Main dispatcher is cancelled on destroyed activity.
Atomic nature of channels is designed to prevent loss of elements,
which is really not an issue for a typical application, but creates problem when used with channels.
* Internal suspendAtomicCancellableCoroutine -> suspendCancellableCoroutine
* Internal suspendAtomicCancellableCoroutineReusable -> suspendCancellableCoroutineReusable
* Remove atomic cancellation from docs
* Ensures that flowOn does not resume downstream after cancellation.
* MODE_ATOMIC_DEFAULT renamed into MODE_ATOMIC
* Introduced MODE_CANCELLABLE_REUSABLE to track suspendCancellableCoroutineReusable
* Better documentation for MODE_XXX constants.
* Added stress test for proper handling of MODE_CANCELLABLE_REUSABLE
and fixed test for #1123 bug with job.join (working in MODE_CANCELLABLE) that was not
properly failing in the absence of the proper code in CancellableContinuationImpl.getResult
* Added test for Flow.combine that should be fixed
* Support extended invokeOnCancellation contract
* Introduced internal tryResumeAtomic
* Channel onUnderliveredElement is introduced as a replacement.
Fixes #1265
Fixes #1813
Fixes #1915
Fixes #1936
Co-authored-by: Louis CAD <louis.cognault@gmail.com>
Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
|
|
When the Executor that was used with Executor.asCoroutineDispatcher() extension rejects the submitted task, it means that it had reached its capacity and so the executing current Job should be canceled to terminate it as soon as possible. This way RejectedExecutionException works as a rate-limiter just like it serves this purpose in executor-based Java code.
Fixes #2003
|
|
* Provide asFlowable and asObservable by their names in binary instead of 'from' function to prevent naming clash for Java users.
* Do not provide @JvmOverloads for convenience of Java interop
* Deprecate ReceiveChannel.asObservable by the way
Fixes #2182
|
|
* Kotlin DSL - 'reactive:reactor'
* Kotlin DSL - 'reactive:jdk9'
* Kotlin DSL - 'kotlinx-coroutines-slf4j'
* Kotlin DSL - 'kotlinx-coroutines-guava'
* Plugin repo management in 'pluginManagement' block
* Remove redundant stdlib dependencies (#2253)
Co-authored-by: Victor Turansky <victor.turansky@gmail.com>
|
|
This commit adds awaitSingle variants similar to awaitFirst ones, but
always emitting the value during onComplete().
Fixes #1993
|
|
Non-deprecated 'jmhJar' configuration (#2032) (+9 squashed commits)
Squashed commits:
[8d07d3695] Use new Kotlin/JS plugin (#1983)
* Use new Kotlin/JS plugin
* Support legacy DCE mode for 1.4-M2
[d22464030] Add Dokka configuration method
[56e1c9bfe] Dokka plugin in 'buildSrc'
[dfdd202e6] Remove unused repositories
[4cf1d02dc] Kotlin DSL - 'javafx'
[d8f7d507e] Avoid task name duplication
[f06a56b8b] Avoid task name duplication
[a09df3de5] Separate 'UnpackAar' action
[fd5bf6b9c] Separate 'RunR8' task
|
|
Fixes #2155
Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
|
|
The race was leading to emitting more items via onNext than requested, the corresponding stress-test was added, too
Fixes #2109
|
|
Co-authored-by: Louis CAD <louis.cognault@gmail.com>
|
|
Make Flow more cancellation friendly:
* flow builder is cancellable by default
* New unambiguous currentCoroutineContext top-level function
* New Flow.cancellable() operator
Fixes #2026
|
|
|
|
* Kotlin DSL - 'android:example-app' (#1940)
* 'android:example-app'. Gradle 5.6.1 - sync with root project
* Kotlin DSL - 'android:example-app'
* Kotlin DSL - 'android:animation-app' (#1941)
* 'android:animation-app'. Gradle 5.6.1 - sync with root project
* Kotlin DSL - 'android:animation-app'
* Kotlin DSL - 'swing' (#1943)
* Kotlin DSL - 'integration:jdk8' (#1944)
* Kotlin DSL - 'test' (#1945)
* Kotlin DSL - 'reactive:reactive' (#1946)
* Kotlin DSL - 'android-unit-tests'
* Use relative paths
* Kotlin DSL - 'js-stub' (#1938) (#1959)
* Kotlin DSL - 'android' (#1938) (#1956)
* Kotlin DSL - 'stdlib-stubs' (#1938) (#1955)
* Kotlin DSL - 'site' (#1938) (#1954)
* Kotlin DSL - 'maven-central' (#1938) (#1953)
* Kotlin DSL - 'benchmarks' (#1938) (#1952)
Co-authored-by: Victor Turansky <victor.turansky@gmail.com>
|
|
Fixes #1883
Co-authored-by: Zac Sweers <zsweers@slack-corp.com>
|
|
|
|
JDK9 Flow integration is implemented as thin
wrappers around the Reactive Streams integration.
|
|
Fixes #1817
|
|
|
|
|
|
|
|
* Use a separate Knit tool version 0.1.2
* Hierarchical knit.properties files are introduced which are
gathered while walking up the directory tree with the properties
in knit resources being top-level ones.
* Freemarker templates for "knit.include" (top-level of example files)
and "test.template" (test template) are introduced with locations that
are resolved from properties.
* KNIT and TEST_OUT directives are not supported anymore.
- Knitting is controlled by "knit.dir" and "knit.pattern" props.
- "test.name" prop or TEST_NAME directive drives test gen.
* All markdown files are now clean of top-level knit-related boilerplate
(only TEST_NAME directive is remaining in some)
* All example files are renumbered. It affects example-basic-xx,
which had the legacy numbering with later insertions.
* All auto-generated files now have the correct source-file name
specified at their beginning, due to consistent use of template
substitution.
* No need to customize knit.pattern anymore (works out-of-the box)
* "knit.name" is automatically generated based on example's file name
"example-basic-01" -> "exampleBasic01"
* Not match-pattern-group woodoo anymore, "knit.pattern" cannot have any
user-defined match groups.
* No need to look for "package xxx" in knitted sources, as the
example's package is always ${knit.package}.${knit.name}
* Simpler test names:
testKotlinxCoroutinesGuideBasic01 -> testExampleBasic01
* Replaced END_TOC with END directive
* Build-scripts are improved:
- Consistent code to use mavenLocal when snapshots versions are used.
- Proper substitution logic to use Android AAR files so that Dokka has correct links to Google APIs.
- Google repository is added to all projects.
|
|
An extremely rare race could happen in any of the tests in
`LeakedExceptionTest` in the following case:
* `withExceptionHandler` runs the block passed to it;
* In one of the last iterations of `repeat`, `select` in `combine`
happens on both flows at the same time, that is, the block that
was passed to `rx[Something]` runs in two threads
simultaneously;
* One of these two threads (thread A) runs anomalously slow;
* The other thread successfully throws an exception;
* This exception is propagated to `catch`, so `collect` is
finished;
* `repeat` is exited, the block passed to `withExceptionHandler` is
done executing;
* `withExceptionHandler` sets back the usual exception handler,
which fails when an exception in JavaRX happens (see
https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling);
* Thread A wakes up and throws an exception. This time, it is
passed not to `handler`, which is made specifically to deal with
this, but to the default handler.
As a fix, now a special coroutine context passed to `rx[Something]`
ensures that the spawned executions are run in a thread pool that
blocks until all the tasks are done.
|
|
Get rid of Hamcrest, which is uncommon in this codebase, and
replace as many `assert` statements from other testing frameworks
as is reasonable with little automation by calls to
`kotlin.test.*`.
|
|
|
|
by one in a default configuration
Also, partially masks #1766
|
|
* When using asFlow().flowOn(...) context is now properly tracked and taken into account for both execution context of the reactive subscription and for injection into Reactor context.
* Publisher.asFlow slow-path implementation is simplified. It does not sure specialized openSubscription anymore, but always uses the same flow request logic.
Fixes #1765
|
|
Use tryOnError in RxJava to make exception delivery check-and-act race free.
Deliver undeliverable exceptions via RxJavaPlugins instead of handleCoroutineException.
This is a deliberate choice for a multiple reasons:
* When using Rx (whether with coroutines or not), undeliverable exceptions are inevitable and users should hook into RxJavaPlugins anyway. We don't want to force them using Rx-specific CoroutineExceptionHandler all over the place
* Undeliverable exceptions provide additional helpful stacktrace and proper way to distinguish them from other unhandled exceptions
* Be consistent with reactor where we don't have try*, thus cannot provide a completely consistent experience with CEH (at least, without wrapping all the subscribers)\
Do the similar in Reactor integration, but without try*, Reactor does not have notion of undeliverable exceoptions and handles them via Operators.* on its own.
Also, get rid of ASCII tables that are not properly render in IDEA
Fixes #252
Fixes #1614
|
|
|
|
|
|
|
|
* Remove obsolete rx-example module
* Properly document interoperability with Reactor context
* Update reactive readme
|
|
reactive primitives
|
|
|
|
|
|
kotlinx.coroutines.reactor.FlowKt with properly named files
Otherwise, it leads to a weird classname clash and forces to write FQ imports
|
|
* Propagation of the coroutine context of await calls into
Mono/Flux builder
* Publisher.asFlow propagates coroutine context from `collect`
call to the Publisher
* Flow.asFlux transform
* Optimized FlowSubscription
* kotlinx.coroutines.reactor.flow package is replaced with kotlinx.coroutines.reactor
Fixes #284
|
|
coroutine context (to eagerly fail as fatal exceptions are not recoverable anyway), cleanup tests after scopeless reactive
|
|
RxObservable
|
|
Fixes #1297
|
|
Fixes #284
|
|
Make all reactive builders top-level functions instead of extensions on CoroutineScope and prohibit jobs in their context
Downsides of having lifecycle-managed scoped builders:
* The lifecycle of semantically cold entity is managed externally by the hot-one.
* Independent failures in independent triggered computations affect each other
* Two cancellation sources should be managed, coroutine-related Job parent and disposable/subscription
|
|
|