From ffabf689e2f6b9e2b1c05aa69034ebbaf9b6839c Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 27 Apr 2015 14:44:46 +0300 Subject: [PATCH] removed ourLockedCHeckedCOunter --- .../progress/impl/CoreProgressManager.java | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/platform/core-impl/src/com/intellij/openapi/progress/impl/CoreProgressManager.java b/platform/core-impl/src/com/intellij/openapi/progress/impl/CoreProgressManager.java index 10cf93a9a905..3bfde5b825e9 100644 --- a/platform/core-impl/src/com/intellij/openapi/progress/impl/CoreProgressManager.java +++ b/platform/core-impl/src/com/intellij/openapi/progress/impl/CoreProgressManager.java @@ -28,7 +28,6 @@ import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.ThrowableComputable; import com.intellij.openapi.wm.ex.ProgressIndicatorEx; -import com.intellij.psi.PsiLock; import com.intellij.util.containers.ConcurrentLongObjectMap; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.SmartHashSet; @@ -53,8 +52,7 @@ public class CoreProgressManager extends ProgressManager implements Disposable { final AtomicInteger myCurrentUnsafeProgressCount = new AtomicInteger(0); private final AtomicInteger myCurrentModalProgressCount = new AtomicInteger(0); - private static volatile int ourLockedCheckCounter = 0; - private static final boolean DISABLED = "disabled".equals(System.getProperty("idea.ProcessCanceledException")); + private static final boolean ENABLED = !"disabled".equals(System.getProperty("idea.ProcessCanceledException")); private final ScheduledFuture myCheckCancelledFuture; // indicator -> threads which are running under this indicator. guarded by this. @@ -94,25 +92,8 @@ public class CoreProgressManager extends ProgressManager implements Disposable { boolean thereIsCanceledIndicator = !threadsUnderCanceledIndicator.isEmpty(); if (thereIsCanceledIndicator) { final ProgressIndicator progress = getProgressIndicator(); - if (progress != null) { - try { - progress.checkCanceled(); - } - catch (ProcessCanceledException e) { - if (DISABLED) { - return; - } - if (Thread.holdsLock(PsiLock.LOCK)) { - ourLockedCheckCounter++; - if (ourLockedCheckCounter > 10) { - ourLockedCheckCounter = 0; - } - } - else { - ourLockedCheckCounter = 0; - throw e; - } - } + if (progress != null && ENABLED) { + progress.checkCanceled(); } } } @@ -326,7 +307,7 @@ public class CoreProgressManager extends ProgressManager implements Disposable { final Runnable process = new TaskRunnable(task, progressIndicator, continuation); - TaskContainer action = new TaskContainer(task) { + Runnable action = new TaskContainer(task) { @Override public void run() { boolean canceled = false;