public class FrameProcessorExecutor extends Object
FrameProcessor in an ExecutorService.
If you want single threaded execution, use Execs.singleThreaded(). It is not a good idea to use this with a
same-thread executor like Execs.directExecutor(), because it will lead to deep call stacks.| Constructor and Description |
|---|
FrameProcessorExecutor(com.google.common.util.concurrent.ListeningExecutorService exec) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel(String cancellationId)
Cancels all processors associated with a given cancellationId.
|
com.google.common.util.concurrent.ListeningExecutorService |
getExecutorService()
Returns the underlying executor service used by this executor.
|
<T,ResultType> |
runAllFully(Sequence<? extends FrameProcessor<T>> processors,
ResultType initialResult,
BiFunction<ResultType,T,ResultType> accumulateFn,
int maxOutstandingProcessors,
Bouncer bouncer,
String cancellationId)
Runs a sequence of processors and returns a future that resolves when execution is complete.
|
<T> com.google.common.util.concurrent.ListenableFuture<T> |
runFully(FrameProcessor<T> processor,
String cancellationId)
Runs a processor until it is done, and returns a future that resolves when execution is complete.
|
public FrameProcessorExecutor(com.google.common.util.concurrent.ListeningExecutorService exec)
public com.google.common.util.concurrent.ListeningExecutorService getExecutorService()
public <T> com.google.common.util.concurrent.ListenableFuture<T> runFully(FrameProcessor<T> processor, @Nullable String cancellationId)
cancel(String) method to cancel all processors
currently running with the same cancellationId.public <T,ResultType> com.google.common.util.concurrent.ListenableFuture<ResultType> runAllFully(Sequence<? extends FrameProcessor<T>> processors, ResultType initialResult, BiFunction<ResultType,T,ResultType> accumulateFn, int maxOutstandingProcessors, Bouncer bouncer, @Nullable String cancellationId)
accumulateFn.processors - sequence of processors to runinitialResult - initial value for result accumulation. If there are no processors at all, this
is returned.accumulateFn - result accumulator. Applied in a critical section, so it should be something
that executes quickly. It gets initialResult for the initial accumulation.maxOutstandingProcessors - maximum number of processors to run at oncebouncer - additional limiter on outstanding processors, beyond maxOutstandingProcessors.
Useful when there is some finite resource being shared against multiple different
calls to this method.cancellationId - optional cancellation id for runFully(org.apache.druid.frame.processor.FrameProcessor<T>, java.lang.String).public void cancel(String cancellationId) throws InterruptedException
InterruptedExceptionCopyright © 2011–2022 The Apache Software Foundation. All rights reserved.