// StatusUpdater should be added last so that it get started last // so that we make sure everything is up before registering with RM. addService(nodeStatusUpdater);
//Transitions from NEW state .addTransition(NodeState.NEW, NodeState.RUNNING, RMNodeEventType.STARTED, new AddNodeTransition()) .addTransition(NodeState.NEW, NodeState.NEW, RMNodeEventType.RESOURCE_UPDATE, new UpdateNodeResourceWhenUnusableTransition())
Node注册最先由AddNodeTransition处理。这个函数通过
1 2 3 4 5
rmNode.context.getDispatcher().getEventHandler() .handle(new NodeAddedSchedulerEvent(rmNode, containers)); rmNode.context.getDispatcher().getEventHandler().handle( new NodesListManagerEvent( NodesListManagerEventType.NODE_USABLE, rmNode));
/** * Get the value of the <code>name</code> property as a <code>Class</code> * implementing the interface specified by <code>xface</code>. * * If no such property is specified, then <code>defaultValue</code> is * returned. * * An exception is thrown if the returned class does not implement the named * interface. * *@param name the class name. *@param defaultValue default value. *@param xface the interface implemented by the named class. *@return property value as a <code>Class</code>, * or <code>defaultValue</code>. */ public <U> Class<? extends U> getClass(String name, Class<? extends U> defaultValue, Class<U> xface) {