一:executor 注册机制 1.worker为application启动的Executor进程是 CoarseGrainedexecutorbackend
2.actor的初始化方法prestart() (1)获取driver的actor (2)向driver发送RegisterExecutor消息,进行反向注册 (3)driver注册成功executor后,返回消息被 RegisteredExecutor 接受, 而后创建executor执行句柄 二:task启动机制 1.launchTask启动Task (1)反序列化task env.closureSerializer.newInstance() ser.deserialize() (2)调用Executor 内部的 launchTask() 1>对每一个task 创建TaskRunner(继承于Runnable接口) 2>将taskRunner放入runningTasks集合(继承于CocurrentHashMap)(作为内存缓存) 3>剑taskRunner放入threadpool中(有排队机制)
流程图: