You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix exception aggregation to ensure atomic handling of exceptions
* Removed legacy onFinishing handler support from JobSupport.
- It is no longer needed, because handleJobException covers #208
* Fixed bugs that were masked by cancelling parent from onFinishing.
* Consistent "Finishing" state was introduced in internal machinery:
- Job enters finishing state when it is failing or it is completing
and has children
- Finishing state cleanly aggregates all failures, tracks cancellation
and completion status
* Job.isFailed is introduced as a consistent way to query the "failing"
state of the job that was previously only implicitly available via
invokeOnCompletion handler (cause != null means a failed job) and
the documentation for both Job & Deferred is updated to reflect that.
* Source-incompatible change: Job.invokeOnCompletion boolean parameter is
change to onFailing. Such handlers are now invoked as soon as the job
starts failing and the root cause exception of the failure is consistently
passed to all the handlers.
* The following internal methods were introduced to facilitate this:
- Job.failParent(exception) is used by child to signal failure to parent
- Job.cancelChild(parentJob) is used by parent to cancel child.
* Child never aggregates exception received from it parent, but uses
it as it root cause if there is no other exception.
* JobSupport.handleJobException() logic for launch/actor is split into:
- failParent - can be invoked multiple times on race;
- handleJobException which is invoked exactly once.
* Exception materiazization is much lazier now, which should
significantly improve performance when cancelling large hierarchies.
* Other minor perf improvements in JobSupport code.
Fixes#585
Copy file name to clipboardExpand all lines: binary-compatibility-validator/reference-public-api/kotlinx-coroutines-core.txt
+7
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
1
public abstract class kotlinx/coroutines/AbstractCoroutine : kotlin/coroutines/Continuation, kotlinx/coroutines/CoroutineScope, kotlinx/coroutines/Job {
2
+
protected final field parentContext Lkotlin/coroutines/experimental/CoroutineContext;
2
3
public fun <init> (Lkotlin/coroutines/CoroutineContext;Z)V
3
4
public synthetic fun <init> (Lkotlin/coroutines/CoroutineContext;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
4
5
public final fun getContext ()Lkotlin/coroutines/CoroutineContext;
@@ -376,7 +377,9 @@ public abstract interface class kotlinx/coroutines/Job : kotlin/coroutines/Corou
376
377
public static final field Key Lkotlinx/coroutines/Job$Key;
377
378
public abstract fun attachChild (Lkotlinx/coroutines/Job;)Lkotlinx/coroutines/DisposableHandle;
378
379
public abstract fun cancel (Ljava/lang/Throwable;)Z
380
+
public abstract fun cancelChild (Lkotlinx/coroutines/experimental/Job;)V
379
381
public abstract synthetic fun cancelChildren (Ljava/lang/Throwable;)V
382
+
public abstract fun childFailed (Ljava/lang/Throwable;)Z
380
383
public abstract fun getCancellationException ()Ljava/util/concurrent/CancellationException;
381
384
public abstract fun getChildren ()Lkotlin/sequences/Sequence;
382
385
public abstract fun getCompletionException ()Ljava/lang/Throwable;
@@ -388,6 +391,7 @@ public abstract interface class kotlinx/coroutines/Job : kotlin/coroutines/Corou
388
391
public abstract fun isActive ()Z
389
392
public abstract fun isCancelled ()Z
390
393
public abstract fun isCompleted ()Z
394
+
public abstract fun isFailed ()Z
391
395
public abstract fun join (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
392
396
public abstract fun plus (Lkotlinx/coroutines/Job;)Lkotlinx/coroutines/Job;
393
397
public abstract fun start ()Z
@@ -447,7 +451,9 @@ public final class kotlinx/coroutines/NonCancellable : kotlin/coroutines/Abstrac
447
451
public static final field INSTANCE Lkotlinx/coroutines/NonCancellable;
448
452
public fun attachChild (Lkotlinx/coroutines/Job;)Lkotlinx/coroutines/DisposableHandle;
449
453
public fun cancel (Ljava/lang/Throwable;)Z
454
+
public fun cancelChild (Lkotlinx/coroutines/experimental/Job;)V
450
455
public synthetic fun cancelChildren (Ljava/lang/Throwable;)V
456
+
public fun childFailed (Ljava/lang/Throwable;)Z
451
457
public fun getCancellationException ()Ljava/util/concurrent/CancellationException;
452
458
public fun getChildren ()Lkotlin/sequences/Sequence;
453
459
public fun getCompletionException ()Ljava/lang/Throwable;
@@ -459,6 +465,7 @@ public final class kotlinx/coroutines/NonCancellable : kotlin/coroutines/Abstrac
459
465
public fun isActive ()Z
460
466
public fun isCancelled ()Z
461
467
public fun isCompleted ()Z
468
+
public fun isFailed ()Z
462
469
public fun join (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
463
470
public fun plus (Lkotlinx/coroutines/Job;)Lkotlinx/coroutines/Job;
0 commit comments