Skip navigation links

Back to Flink Website


Interface ListCheckpointed<T extends Serializable>

    • Method Detail

      • snapshotState

        List<T> snapshotState(long checkpointId,
                              long timestamp)
                       throws Exception
        Gets the current state of the function. The state must reflect the result of all prior invocations to this function.

        The returned list should contain one entry for redistributable unit of state. See the class docs for an illustration how list-style state redistribution works.

        As special case, the returned list may be null or empty (if the operator has no state) or it may contain a single element (if the operator state is indivisible).

        checkpointId - The ID of the checkpoint - a unique and monotonously increasing value.
        timestamp - The wall clock timestamp when the checkpoint was triggered by the master.
        The operator state in a list of redistributable, atomic sub-states. Should not return null, but empty list instead.
        Exception - Thrown if the creation of the state object failed. This causes the checkpoint to fail. The system may decide to fail the operation (and trigger recovery), or to discard this checkpoint attempt and to continue running and to try again with the next checkpoint attempt.
      • restoreState

        void restoreState(List<T> state)
                   throws Exception
        Restores the state of the function or operator to that of a previous checkpoint. This method is invoked when the function is executed after a failure recovery. The state list may be empty if no state is to be recovered by the particular parallel instance of the function.

        The given state list will contain all the sub states that this parallel instance of the function needs to handle. Refer to the class docs for an illustration how list-style state redistribution works.

        Important: When implementing this interface together with RichFunction, then the restoreState() method is called before

        state - The state to be restored as a list of atomic sub-states.
        Exception - Throwing an exception in this method causes the recovery to fail. The exact consequence depends on the configured failure handling strategy, but typically the system will re-attempt the recovery, or try recovering from a different checkpoint.

Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.