Class FiniteTestSource<T>

  • All Implemented Interfaces:
    Serializable, org.apache.flink.api.common.functions.Function, org.apache.flink.api.common.state.CheckpointListener, org.apache.flink.streaming.api.functions.source.legacy.SourceFunction<T>

    public class FiniteTestSource<T>
    extends Object
    implements org.apache.flink.streaming.api.functions.source.legacy.SourceFunction<T>, org.apache.flink.api.common.state.CheckpointListener
    A stream source that: 1) emits a list of elements without allowing checkpoints, 2) then waits for two more checkpoints to complete, 3) then re-emits the same elements before 4) waiting for another two checkpoints and 5) exiting.

    This class was written to test the Bulk Writers used by the StreamingFileSink.

    See Also:
    Serialized Form
    • Constructor Detail

      • FiniteTestSource

        @SafeVarargs
        public FiniteTestSource​(T... elements)
      • FiniteTestSource

        public FiniteTestSource​(Iterable<T> elements)
      • FiniteTestSource

        public FiniteTestSource​(@Nullable
                                BooleanSupplier couldExit,
                                long waitTimeOut,
                                Iterable<T> elements)
    • Method Detail

      • run

        public void run​(org.apache.flink.streaming.api.functions.source.legacy.SourceFunction.SourceContext<T> ctx)
                 throws Exception
        Specified by:
        run in interface org.apache.flink.streaming.api.functions.source.legacy.SourceFunction<T>
        Throws:
        Exception
      • cancel

        public void cancel()
        Specified by:
        cancel in interface org.apache.flink.streaming.api.functions.source.legacy.SourceFunction<T>
      • notifyCheckpointComplete

        public void notifyCheckpointComplete​(long checkpointId)
                                      throws Exception
        Specified by:
        notifyCheckpointComplete in interface org.apache.flink.api.common.state.CheckpointListener
        Throws:
        Exception
      • notifyCheckpointAborted

        public void notifyCheckpointAborted​(long checkpointId)
        Specified by:
        notifyCheckpointAborted in interface org.apache.flink.api.common.state.CheckpointListener