Class EpochManager


  • public class EpochManager
    extends Object
    Epoch manager segments inputs into distinct epochs, marked by the arrival of non-records(e.g. watermark, record attributes). Records are assigned to a unique epoch based on their arrival, records within an epoch are allowed to be parallelized, while the non-record of an epoch can only be executed when all records in this epoch have finished.

    For more details please refer to FLIP-425.

    • Method Detail

      • onRecord

        public EpochManager.Epoch onRecord()
        Add a record to the current epoch and return the current open epoch, the epoch will be associated with the RecordContext of this record. Must be invoked within task thread.
        Returns:
        the current open epoch.
      • onEpoch

        public EpochManager.Epoch onEpoch​(EpochManager.Epoch epoch)
        Add a record to a specified epoch.
        Parameters:
        epoch - the specified epoch.
        Returns:
        the specified epoch itself.
      • onNonRecord

        public void onNonRecord​(@Nullable
                                Runnable triggerAction,
                                @Nullable
                                Runnable finalAction,
                                EpochManager.ParallelMode parallelMode)
        Add a non-record to the current epoch, close current epoch and open a new epoch. Must be invoked within task thread.
        Parameters:
        triggerAction - the action associated with this non-record.
        parallelMode - the parallel mode for this epoch.
      • completeOneRecord

        public void completeOneRecord​(EpochManager.Epoch epoch)
        Complete one record in the specific epoch. Must be invoked within task thread.
        Parameters:
        epoch - the specific epoch