public abstract class JobLauncher
extends java.lang.Object
Application.executeOnPooledThread(java.lang.Runnable)
,
ProcessIOExecutorService
and com.intellij.util.concurrency.NonUrgentExecutor
for that.Constructor and Description |
---|
JobLauncher() |
Modifier and Type | Method and Description |
---|---|
static JobLauncher |
getInstance() |
abstract <T> boolean |
invokeConcurrentlyUnderProgress(java.util.List<? extends T> things,
ProgressIndicator progress,
boolean runInReadAction,
boolean failFastOnAcquireReadAction,
Processor<? super T> thingProcessor) |
<T> boolean |
invokeConcurrentlyUnderProgress(java.util.List<? extends T> things,
ProgressIndicator progress,
boolean failFastOnAcquireReadAction,
Processor<? super T> thingProcessor)
Deprecated.
|
<T> boolean |
invokeConcurrentlyUnderProgress(java.util.List<? extends T> things,
ProgressIndicator progress,
Processor<? super T> thingProcessor)
Schedules concurrent execution of
thingProcessor over each element of things and waits for completion
with checkCanceled in each thread delegated to the progress (or the current global progress if null). |
abstract Job<java.lang.Void> |
submitToJobThread(java.lang.Runnable action,
Consumer<? super java.util.concurrent.Future<?>> onDoneCallback)
NEVER EVER submit runnable which can lock itself for indeterminate amount of time.
|
public static JobLauncher getInstance()
public <T> boolean invokeConcurrentlyUnderProgress(java.util.List<? extends T> things, ProgressIndicator progress, Processor<? super T> thingProcessor) throws ProcessCanceledException
thingProcessor
over each element of things
and waits for completion
with checkCanceled in each thread delegated to the progress
(or the current global progress if null).
Note: When the thingProcessor
throws an exception or returns false
or the current indicator is canceled,
the method is finished with false
as soon as possible,
which means some workers might still be in flight to completion. On the other hand, when the method returns true
,
it's guaranteed that the whole list was processed and all tasks completed.things
- data to process concurrentlyprogress
- progress indicatorthingProcessor
- to be invoked concurrently on each element from the collectionProcessCanceledException
- if at least one task has thrown ProcessCanceledException@Deprecated public <T> boolean invokeConcurrentlyUnderProgress(java.util.List<? extends T> things, ProgressIndicator progress, boolean failFastOnAcquireReadAction, Processor<? super T> thingProcessor) throws ProcessCanceledException
invokeConcurrentlyUnderProgress(List, ProgressIndicator, Processor)
insteadthings
- data to process concurrentlyprogress
- progress indicatorfailFastOnAcquireReadAction
- if true, returns false when failed to acquire read actionthingProcessor
- to be invoked concurrently on each element from the collectionProcessCanceledException
- if at least one task has thrown ProcessCanceledExceptionpublic abstract <T> boolean invokeConcurrentlyUnderProgress(java.util.List<? extends T> things, ProgressIndicator progress, boolean runInReadAction, boolean failFastOnAcquireReadAction, Processor<? super T> thingProcessor) throws ProcessCanceledException
ProcessCanceledException
public abstract Job<java.lang.Void> submitToJobThread(java.lang.Runnable action, Consumer<? super java.util.concurrent.Future<?>> onDoneCallback)
Application.executeOnPooledThread(Runnable)
instead