mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
call Alarm.request() less often to avoid contention in Alarm.isEmpty()
This commit is contained in:
@@ -359,6 +359,7 @@ public class ProgressWindow extends ProgressIndicatorBase implements BlockingPro
|
||||
}
|
||||
|
||||
private class MyDelegate extends AbstractProgressIndicatorBase implements ProgressIndicatorEx {
|
||||
private long myLastUpdatedButtonTimestamp;
|
||||
@Override
|
||||
public void cancel() {
|
||||
super.cancel();
|
||||
@@ -371,7 +372,11 @@ public class ProgressWindow extends ProgressIndicatorBase implements BlockingPro
|
||||
public void checkCanceled() {
|
||||
super.checkCanceled();
|
||||
// assume checkCanceled() would be called from the correct thread
|
||||
enableCancelButton(!ProgressManager.getInstance().isInNonCancelableSection());
|
||||
long now = System.currentTimeMillis();
|
||||
if (now - myLastUpdatedButtonTimestamp > 10) {
|
||||
enableCancelButton(!ProgressManager.getInstance().isInNonCancelableSection());
|
||||
myLastUpdatedButtonTimestamp = now;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user