AMLauncher.launch(基于hadoop 2.7.6)
主要有launch、cleanup方法,launch和cleanup方法分别实现了处理LAUNCH和CLEAN事件的逻辑.
1.对于LAUNCH事件,launch方法会调用rpc方法startContainers启动Container
2.触发RMAppAttemptEventType.LAUNCHED事件.
public class AMLauncher implements Runnable {
...省略...
@SuppressWarnings("unchecked")
public void run() {
switch (eventType) {
case LAUNCH:
try {
LOG.info("Launching master" + application.getAppAttemptId());
/**
* 主要是通过rpc方法startContainers启动Container
*/
launch();
/**
* 触发RMAppAttemptEventType.LAUNCHED事件
*/
handler.handle(new RMAppAttemptEvent(application.getAppAttemptId(),
RMAppAttemptEventType.LAUNCHED));
} catch(Exception ie) {
String message = "Error launching " + app