mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -62,8 +62,8 @@ public class JobSchedulerImpl extends JobScheduler implements Disposable {
|
||||
return ourQueue.poll();
|
||||
}
|
||||
|
||||
static void submitTask(PrioritizedFutureTask future, boolean callerHasReadAccess, boolean reportExceptions) {
|
||||
future.beforeRun(callerHasReadAccess, reportExceptions);
|
||||
static void submitTask(@NotNull PrioritizedFutureTask future, boolean runInReadAction, boolean reportExceptions) {
|
||||
future.beforeRun(runInReadAction, reportExceptions);
|
||||
ourExecutor.executeTask(future);
|
||||
}
|
||||
|
||||
@@ -72,12 +72,12 @@ public class JobSchedulerImpl extends JobScheduler implements Disposable {
|
||||
super(CORES_COUNT, Integer.MAX_VALUE, 60 * 10, TimeUnit.SECONDS, ourQueue, WORKERS_FACTORY);
|
||||
}
|
||||
|
||||
private void executeTask(final PrioritizedFutureTask task) {
|
||||
private void executeTask(@NotNull PrioritizedFutureTask task) {
|
||||
super.execute(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Runnable command) {
|
||||
public void execute(@NotNull Runnable command) {
|
||||
throw new IllegalStateException("Use executeTask() to submit PrioritizedFutureTasks only");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class PrioritizedFutureTask<T> extends FutureTask<T> implements Comparable<Prior
|
||||
private final int myTaskIndex;
|
||||
private final int myPriority;
|
||||
private final boolean myFailFastOnAcquireReadAction;
|
||||
private volatile boolean myParentThreadHasReadAccess;
|
||||
private volatile boolean myRunInReadAction;
|
||||
private volatile boolean myReportExceptions;
|
||||
|
||||
PrioritizedFutureTask(final Callable<T> callable,
|
||||
@@ -53,8 +53,8 @@ class PrioritizedFutureTask<T> extends FutureTask<T> implements Comparable<Prior
|
||||
myFailFastOnAcquireReadAction = failFastOnAcquireReadAction;
|
||||
}
|
||||
|
||||
public void beforeRun(boolean parentThreadHasReadAccess, boolean reportExceptions) {
|
||||
myParentThreadHasReadAccess = parentThreadHasReadAccess;
|
||||
public void beforeRun(boolean runInReadAction, boolean reportExceptions) {
|
||||
myRunInReadAction = runInReadAction;
|
||||
myReportExceptions = reportExceptions;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class PrioritizedFutureTask<T> extends FutureTask<T> implements Comparable<Prior
|
||||
}
|
||||
}
|
||||
};
|
||||
if (myParentThreadHasReadAccess) {
|
||||
if (myRunInReadAction) {
|
||||
// have to start "real" read action so that we cannot start write action until we are finished here
|
||||
if (myFailFastOnAcquireReadAction) {
|
||||
if (!ApplicationManagerEx.getApplicationEx().tryRunReadAction(runnable)) {
|
||||
|
||||
Reference in New Issue
Block a user