Package org.apache.druid.frame.processor
Class ReturnOrAwait<T>
- java.lang.Object
-
- org.apache.druid.frame.processor.ReturnOrAwait<T>
-
public class ReturnOrAwait<T> extends Object
Instances of this class are returned byFrameProcessor.runIncrementally(it.unimi.dsi.fastutil.ints.IntSet)
, and are used byFrameProcessorExecutor
to manage execution. An instance can be a "return" with a result, which means that theFrameProcessor
is done working. In this caseisReturn()
is true andvalue()
contains the result. An instance can also be an "await", which means that theFrameProcessor
wants to be scheduled again in the future. In this caseisAwait()
is true,awaitSet()
contains the set of input channels to wait for, andisAwaitAll()
is whether the processor wants to wait for all channels, or any channel.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> ReturnOrAwait<T>
awaitAll(int count)
Wait for all of a certain number of channels.static <T> ReturnOrAwait<T>
awaitAll(it.unimi.dsi.fastutil.ints.IntSet await)
Wait for all provided channels to become readable (or finished).static <T> ReturnOrAwait<T>
awaitAny(it.unimi.dsi.fastutil.ints.IntSet await)
Wait for any of the provided channels to become readable (or finished).it.unimi.dsi.fastutil.ints.IntSet
awaitSet()
The set of channels the processors wants to wait for.boolean
equals(Object o)
int
hashCode()
boolean
isAwait()
Whether the processor wants to be scheduled again.boolean
isAwaitAll()
Whether the processor wants to wait for all channels inawaitSet()
(true), or any channel (false)boolean
isReturn()
Whether the processor has returned a value.static <T> ReturnOrAwait<T>
returnObject(T o)
Return a result.static <T> ReturnOrAwait<T>
runAgain()
Wait for nothing; that is: run again as soon as possible.String
toString()
T
value()
The returned result.
-
-
-
Method Detail
-
runAgain
public static <T> ReturnOrAwait<T> runAgain()
Wait for nothing; that is: run again as soon as possible.
-
awaitAll
public static <T> ReturnOrAwait<T> awaitAll(it.unimi.dsi.fastutil.ints.IntSet await)
Wait for all provided channels to become readable (or finished). Numbers in this set correspond to positions in theFrameProcessor.inputChannels()
list. It is OK to pass in a mutable set, because this method does not modify the set or retain a reference to it.
-
awaitAll
public static <T> ReturnOrAwait<T> awaitAll(int count)
Wait for all of a certain number of channels.
-
awaitAny
public static <T> ReturnOrAwait<T> awaitAny(it.unimi.dsi.fastutil.ints.IntSet await)
Wait for any of the provided channels to become readable (or finished). When using this, callers should consider removing any fully-processed and finished channels from the await-set, because if any channels in the await-set are finished, the processor will run again immediately. Numbers in this set correspond to positions in theFrameProcessor.inputChannels()
list. It is OK to pass in a mutable set, because this method does not modify the set or retain a reference to it.
-
returnObject
public static <T> ReturnOrAwait<T> returnObject(T o)
Return a result.
-
value
@Nullable public T value()
The returned result. Valid ifisReturn()
is true.
-
awaitSet
public it.unimi.dsi.fastutil.ints.IntSet awaitSet()
The set of channels the processors wants to wait for. Valid ifisAwait()
is true. Numbers in this set correspond to positions in theFrameProcessor.inputChannels()
list.
-
isReturn
public boolean isReturn()
Whether the processor has returned a value. This is the opposite ofisAwait()
.
-
isAwait
public boolean isAwait()
Whether the processor wants to be scheduled again. This is the opposite ofisReturn()
.
-
isAwaitAll
public boolean isAwaitAll()
Whether the processor wants to wait for all channels inawaitSet()
(true), or any channel (false)
-
-