Class GenericWriteAheadSink<IN>

    • Field Detail

      • LOG

        protected static final org.slf4j.Logger LOG
    • Method Detail

      • open

        public void open()
                  throws Exception
        Description copied from class: AbstractStreamOperator
        This method is called immediately before any elements are processed, it should contain the operator's initialization logic, e.g. state initialization.

        The default implementation does nothing.

        Specified by:
        open in interface StreamOperator<IN>
        Overrides:
        open in class AbstractStreamOperator<IN>
        Throws:
        Exception - An exception in this method causes the operator to fail.
      • close

        public void close()
                   throws Exception
        Description copied from interface: StreamOperator
        This method is called at the very end of the operator's life, both in the case of a successful completion of the operation, and in the case of a failure and canceling.

        This method is expected to make a thorough effort to release all resources that the operator has acquired.

        NOTE:It can not emit any records! If you need to emit records at the end of processing, do so in the StreamOperator.finish() method.

        Specified by:
        close in interface StreamOperator<IN>
        Overrides:
        close in class AbstractStreamOperator<IN>
        Throws:
        Exception
      • notifyCheckpointComplete

        public void notifyCheckpointComplete​(long checkpointId)
                                      throws Exception
        Description copied from interface: CheckpointListener
        Notifies the listener that the checkpoint with the given checkpointId completed and was committed.

        These notifications are "best effort", meaning they can sometimes be skipped. To behave properly, implementers need to follow the "Checkpoint Subsuming Contract". Please see the class-level JavaDocs for details.

        Please note that checkpoints may generally overlap, so you cannot assume that the notifyCheckpointComplete() call is always for the latest prior checkpoint (or snapshot) that was taken on the function/operator implementing this interface. It might be for a checkpoint that was triggered earlier. Implementing the "Checkpoint Subsuming Contract" (see above) properly handles this situation correctly as well.

        Please note that throwing exceptions from this method will not cause the completed checkpoint to be revoked. Throwing exceptions will typically cause task/job failure and trigger recovery.

        Specified by:
        notifyCheckpointComplete in interface CheckpointListener
        Overrides:
        notifyCheckpointComplete in class AbstractStreamOperator<IN>
        Parameters:
        checkpointId - The ID of the checkpoint that has been completed.
        Throws:
        Exception - This method can propagate exceptions, which leads to a failure/recovery for the task. Note that this will NOT lead to the checkpoint being revoked.
      • sendValues

        protected abstract boolean sendValues​(Iterable<IN> values,
                                              long checkpointId,
                                              long timestamp)
                                       throws Exception
        Write the given element into the backend.
        Parameters:
        values - The values to be written
        checkpointId - The checkpoint ID of the checkpoint to be written
        timestamp - The wall-clock timestamp of the checkpoint
        Returns:
        true, if the sending was successful, false otherwise
        Throws:
        Exception