ITPub博客

首页 > > > Flink中的状态与容错-2

Flink中的状态与容错-2

作者:longmanma 时间:2019-12-18 17:59:40 0 删除 编辑

2.1. 它的snapshotState调用过程如下:

核心类StreamTask

/** * Base class for all streaming tasks. A task is the unit of local processing that is deployed

* and executed by the TaskManagers. Each task runs one or more {@link StreamOperator}s which form

* the Task's operator chain. Operators that are chained together execute synchronously in the

* same thread and hence on the same stream partition. A common case for these chains

* are successive map/flatmap/filter tasks.

*

* <p>The task chain contains one "head" operator and multiple chained operators.

* The StreamTask is specialized for the type of the head operator: one-input and two-input tasks,

* as well as for sources, iteration heads and iteration tails.

*

* <p>The Task class deals with the setup of the streams read by the head operator, and the streams

* produced by the operators at the ends of the operator chain. Note that the chain may fork and

* thus have multiple ends.

*

* <p>The life cycle of the task is set up as follows:

* <pre>{@code * -- setInitialState -> provides state of all operators in the chain

*

* -- invoke()

* |

* +----> Create basic utils (config, etc) and load the chain of operators

* +----> operators.setup()

* +----> task specific init()

* +----> initialize-operator-states()

* +----> open-operators()

* +----> run()

* +----> close-operators()

* +----> dispose-operators()

* +----> common cleanup

* +----> task specific cleanup()

* }</pre>

*

* <p>The {@code StreamTask} has a lock object called {@code lock}. All calls to methods on a

* {@code StreamOperator} must be synchronized on this lock object to ensure that no methods

* are called concurrently.

*

* @param <OUT>

* @param <OP>

*/

2.2.它的initializeState调用过程如下:

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2730/viewspace-3162464/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-12-18

  • 博文量
    492
  • 访问量
    11988