Package org.apache.druid.frame.processor
Class FrameProcessorExecutor
- java.lang.Object
-
- org.apache.druid.frame.processor.FrameProcessorExecutor
-
public class FrameProcessorExecutor extends Object
Manages execution ofFrameProcessor
in anExecutorService
. If you want single threaded execution, useExecs.singleThreaded()
. It is not a good idea to use this with a same-thread executor likeExecs.directExecutor()
, because it will lead to deep call stacks.
-
-
Constructor Summary
Constructors Constructor Description FrameProcessorExecutor(com.google.common.util.concurrent.ListeningExecutorService exec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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,R>
com.google.common.util.concurrent.ListenableFuture<R>runAllFully(ProcessorManager<T,R> processorManager, 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.
-
-
-
Method Detail
-
getExecutorService
public com.google.common.util.concurrent.ListeningExecutorService getExecutorService()
Returns the underlying executor service used by this executor.
-
runFully
public <T> com.google.common.util.concurrent.ListenableFuture<T> runFully(FrameProcessor<T> processor, @Nullable String cancellationId)
Runs a processor until it is done, and returns a future that resolves when execution is complete. If "cancellationId" is provided, it can be used with thecancel(String)
method to cancel all processors currently running with the same cancellationId.
-
runAllFully
public <T,R> com.google.common.util.concurrent.ListenableFuture<R> runAllFully(ProcessorManager<T,R> processorManager, int maxOutstandingProcessors, Bouncer bouncer, @Nullable String cancellationId)
Runs a sequence of processors and returns a future that resolves when execution is complete. Returns a value accumulated using the providedaccumulateFn
.- Parameters:
processorManager
- processors to runmaxOutstandingProcessors
- 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 forrunFully(org.apache.druid.frame.processor.FrameProcessor<T>, java.lang.String)
.
-
cancel
public void cancel(String cancellationId) throws InterruptedException
Cancels all processors associated with a given cancellationId. Waits for the processors to exit before returning.- Throws:
InterruptedException
-
-