Class AmplificationFactorAdapter

  • public class AmplificationFactorAdapter
    extends java.lang.Object
    This class hides and handles amplification factor concept for each user partition. All the sub-partition logics and concepts are handled here.
    • Constructor Detail

      • AmplificationFactorAdapter

        public AmplificationFactorAdapter​(int amplificationFactor,
                                          java.util.concurrent.ConcurrentMap<java.lang.Integer,​PartitionConsumptionState> partitionConsumptionStateMap)
    • Method Detail

      • executePartitionConsumptionState

        public void executePartitionConsumptionState​(int userPartition,
                                                     java.util.function.Consumer<PartitionConsumptionState> pcsConsumer)
        This method takes in customized logic and execute it on every subPartition's PartitionConsumptionState of the user partition.
      • execute

        public void execute​(int userPartition,
                            java.util.function.Consumer<java.lang.Integer> consumer)
        This method takes in customized logic for each subPartition number and be executed on every subPartition of the specified user partition.
      • meetsAny

        public boolean meetsAny​(int userPartition,
                                java.util.function.Predicate<java.lang.Integer> predicate)
        This method returns True when the predicate is tested True for any of the subPartition in the user partition.
      • isLeaderSubPartition

        public boolean isLeaderSubPartition​(int subPartition)
        True if a subPartition's index is the first among all subPartitions of its user partition.
      • getAmplificationFactor

        public int getAmplificationFactor()