private MasterContext context;
private static Logger log = LoggerFactory.getLogger(Master.class);
public Master(final MasterContext context) {
this.context = context;
GroupBean root = context.getGroupManager().getGlobeGroupBean();
if (Environment.isPrePub()) {
// 如果是预发环境,添加stop listener,阻止自动调度执行
context.getDispatcher().addDispatcherListener(
new StopScheduleJobListener());
}
context.getDispatcher().addDispatcherListener(
new AddJobListener(context, this));
context.getDispatcher().addDispatcherListener(
new JobFailListener(context));
context.getDispatcher().addDispatcherListener(
new DebugListener(context));
context.getDispatcher().addDispatcherListener(
new JobSuccessListener(context));
Map<String, JobBean> allJobBeans = root.getAllSubJobBeans();
for (String id : allJobBeans.keySet()) {
context.getDispatcher().addController(
new JobController(context, this, id));
}