Interface SubpartitionSelector<T>
-
- Type Parameters:
T- data type that could be used to represent a subpartition.
- All Known Implementing Classes:
RoundRobinSubpartitionSelector
public interface SubpartitionSelector<T>SubpartitionSelectorhelps to choose from multiple available subpartitions when their output buffers should union into one stream.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TgetNextSubpartitionToConsume()Returns the next subpartition to consume data.booleanisMoreSubpartitionSwitchable()Whether the invoker can get a different subpartition in the next invocation ofgetNextSubpartitionToConsume().voidmarkLastConsumptionStatus(boolean isDataAvailable, boolean isPartialRecord)Records the status of the last consumption attempt on the subpartition returned by the last invocation ofgetNextSubpartitionToConsume().booleannotifyDataAvailable(T subpartition)Marks a subpartition as having data available.
-
-
-
Method Detail
-
notifyDataAvailable
boolean notifyDataAvailable(T subpartition)
Marks a subpartition as having data available.- Returns:
- true if this selector did not already contain the subpartition.
-
getNextSubpartitionToConsume
T getNextSubpartitionToConsume()
Returns the next subpartition to consume data.
-
markLastConsumptionStatus
void markLastConsumptionStatus(boolean isDataAvailable, boolean isPartialRecord)Records the status of the last consumption attempt on the subpartition returned by the last invocation ofgetNextSubpartitionToConsume().This method must be invoked every time a subpartition acquired from this class is consumed.
- Parameters:
isDataAvailable- whether the consumption returned a valid data.isPartialRecord- whether the returned data contains partial record. Ignored if there was no data available.
-
isMoreSubpartitionSwitchable
boolean isMoreSubpartitionSwitchable()
Whether the invoker can get a different subpartition in the next invocation ofgetNextSubpartitionToConsume().
-
-