600.Task(最终运行 spout 或 bolt 中代码的单元)

是最终运行 spout 或 bolt 中代码的单元(注:1 个 task 即为 spout 或 bolt 的 1 个实例,executor 线程在执行期间会调用该 task 的 nextTuple 或 execute 方法)。topology 启动后,1个 component(spout 或 bolt)的 task 数目是固定不变的,但该 component 使用的 executor 线程数可以动态调整(例如:1 个 executor 线程可以执行该 component 的 1 个或多个 task 实例)。这意味着,对于 1 个 component 存在这样的条件:#threads<=#tasks(即:线程数小于等于 task 数目)。默认情况下 task 的数目等于 executor 线程数目,即 1 个 executor 线程只运行 1 个 task。