mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
simplify, reduce volatile write count
This commit is contained in:
@@ -46,7 +46,7 @@ public abstract class ProgressIndicatorProvider {
|
||||
return ourInstance != null ? ourInstance.startNonCancelableSection() : NonCancelableSection.EMPTY;
|
||||
}
|
||||
|
||||
public static volatile boolean ourNeedToCheckCancel = false;
|
||||
protected static volatile boolean ourNeedToCheckCancel = false;
|
||||
public static void checkCanceled() throws ProcessCanceledException {
|
||||
// smart optimization! There's a thread started in ProgressManagerImpl, that set's this flag up once in 10 milliseconds
|
||||
if (ourNeedToCheckCancel && ourInstance != null) {
|
||||
|
||||
@@ -63,7 +63,6 @@ public class ProgressManagerImpl extends ProgressManager implements Disposable {
|
||||
@Override
|
||||
public void run() {
|
||||
ourNeedToCheckCancel = true;
|
||||
ProgressIndicatorProvider.ourNeedToCheckCancel = true;
|
||||
}
|
||||
}, 0, 10, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
@@ -85,7 +84,6 @@ public class ProgressManagerImpl extends ProgressManager implements Disposable {
|
||||
if (ourLockedCheckCounter > 10) {
|
||||
ourLockedCheckCounter = 0;
|
||||
ourNeedToCheckCancel = true;
|
||||
ProgressIndicatorProvider.ourNeedToCheckCancel = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -98,7 +96,6 @@ public class ProgressManagerImpl extends ProgressManager implements Disposable {
|
||||
|
||||
public static void canceled() {
|
||||
ourNeedToCheckCancel = true;
|
||||
ProgressIndicatorProvider.ourNeedToCheckCancel = true;
|
||||
}
|
||||
|
||||
private static class NonCancelableIndicator extends EmptyProgressIndicator implements NonCancelableSection {
|
||||
|
||||
Reference in New Issue
Block a user