public class RoundRobinSubpartitionSelector<T> extends Object implements SubpartitionSelector<T>
SubpartitionSelector
that selects all subpartitions in round-robin order.Constructor and Description |
---|
RoundRobinSubpartitionSelector() |
Modifier and Type | Method and Description |
---|---|
T |
getNextSubpartitionToConsume()
Returns the next subpartition to consume data.
|
boolean |
isMoreSubpartitionSwitchable()
Whether the invoker can get a different subpartition in the next invocation of
SubpartitionSelector.getNextSubpartitionToConsume() . |
void |
markLastConsumptionStatus(boolean isDataAvailable,
boolean isPartialRecord)
Records the status of the last consumption attempt on the subpartition returned by the last
invocation of
SubpartitionSelector.getNextSubpartitionToConsume() . |
boolean |
notifyDataAvailable(T subpartition)
Marks a subpartition as having data available.
|
public boolean notifyDataAvailable(T subpartition)
SubpartitionSelector
notifyDataAvailable
in interface SubpartitionSelector<T>
public T getNextSubpartitionToConsume()
SubpartitionSelector
getNextSubpartitionToConsume
in interface SubpartitionSelector<T>
public void markLastConsumptionStatus(boolean isDataAvailable, boolean isPartialRecord)
SubpartitionSelector
SubpartitionSelector.getNextSubpartitionToConsume()
.
This method must be invoked every time a subpartition acquired from this class is consumed.
markLastConsumptionStatus
in interface SubpartitionSelector<T>
isDataAvailable
- whether the consumption returned a valid data.isPartialRecord
- whether the returned data contains partial record. Ignored if there
was no data available.public boolean isMoreSubpartitionSwitchable()
SubpartitionSelector
SubpartitionSelector.getNextSubpartitionToConsume()
.isMoreSubpartitionSwitchable
in interface SubpartitionSelector<T>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.