mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
[platform] IJPL-158412: Do not fill stacktrace on cancellation of NonBlockingReadAction
GitOrigin-RevId: b415918b261915f230005e9c1cec5428156ec315
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e5bd548bb2
commit
522b9404d5
@@ -329,7 +329,9 @@ public final class NonBlockingReadActionImpl<T> implements NonBlockingReadAction
|
||||
// We need to abort the job only in the first case, but not in the second one.
|
||||
// Because in the case of `setResult` there can be a UI callback, and we need to cancel Job strictly after the callback finishes.
|
||||
if (!isSucceeded()) {
|
||||
cancelJob(new CancellationException());
|
||||
// we must not create CancellationException here,
|
||||
// because filling the stacktrace causes performance degradation
|
||||
cancelJob(null);
|
||||
}
|
||||
cleanupIfNeeded();
|
||||
return result;
|
||||
|
||||
@@ -727,7 +727,7 @@ class CancellationPropagationTest {
|
||||
}
|
||||
|
||||
@RepeatedTest(1000)
|
||||
fun `synchronous non-blocking read action is awaited`() = runBlocking {
|
||||
fun `synchronous non-blocking read action is awaited`() = timeoutRunBlocking {
|
||||
val dummyDisposable = Disposer.newDisposable()
|
||||
var allowedToCompleteRA by AtomicReference(false)
|
||||
val readActionCompletedSemaphore = Semaphore(1)
|
||||
@@ -761,7 +761,7 @@ class CancellationPropagationTest {
|
||||
.submit(executor)
|
||||
}
|
||||
Disposer.dispose(dummyDisposable)
|
||||
// if NBRA is not properly canceled, we would have a leaking Job, and `blockingContextScope would never finish`
|
||||
// if NBRA is not properly canceled, we would have a leaking Job, and `blockingContextScope` would never finish
|
||||
job.join()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user