@Override public void transition(ApplicationImpl app, ApplicationEvent event) { LOG.warn("Log Aggregation service failed to initialize, there will " + "be no logs for this application"); app.dispatcher.getEventHandler().handle( new ApplicationLocalizationEvent( LocalizationEventType.INIT_APPLICATION_RESOURCES, app)); } }
@Override public void transition(ContainerImpl container, ContainerEvent event) { // Container was PAUSED so tell the scheduler container.dispatcher.getEventHandler().handle( new ContainerSchedulerEvent(container, ContainerSchedulerEventType.CONTAINER_PAUSED)); } }
@Override @SuppressWarnings("unchecked") // dispatcher not typed public void run() { dispatcher.getEventHandler().handle( new LocalizationEvent(LocalizationEventType.CACHE_CLEANUP)); }
@SuppressWarnings("unchecked") // dispatcher not typed @Override public void sendKillEvent(int exitStatus, String description) { this.isMarkeForKilling = true; dispatcher.getEventHandler().handle( new ContainerKillEvent(containerId, exitStatus, description)); }
@SuppressWarnings("unchecked") // dispatcher not typed @Override public void sendPauseEvent(String description) { dispatcher.getEventHandler().handle( new ContainerPauseEvent(containerId, description)); }
@SuppressWarnings("unchecked") // dispatcher not typed private void sendRelaunchEvent() { ContainersLauncherEventType launcherEvent = ContainersLauncherEventType.RELAUNCH_CONTAINER; dispatcher.getEventHandler().handle( new ContainersLauncherEvent(this, launcherEvent)); }
@Override public void transition(ContainerImpl container, ContainerEvent event) { // Pause the process/process-grp if it is supported by the container container.dispatcher.getEventHandler().handle( new ContainersLauncherEvent(container, ContainersLauncherEventType.RESUME_CONTAINER)); ContainerResumeEvent resumeEvent = (ContainerResumeEvent) event; container.addDiagnostics(resumeEvent.getDiagnostic() + "\n"); } }
@Override public void transition(ContainerImpl container, ContainerEvent event) { // Pause the process/process-grp if it is supported by the container container.dispatcher.getEventHandler().handle( new ContainersLauncherEvent(container, ContainersLauncherEventType.PAUSE_CONTAINER)); ContainerPauseEvent pauseEvent = (ContainerPauseEvent) event; container.addDiagnostics(pauseEvent.getDiagnostic() + "\n"); } }
/** * To be used to release a container via a Scheduler Event rather than * in the same thread. * @param container Container. */ public void asyncContainerRelease(RMContainer container) { this.rmContext.getDispatcher().getEventHandler().handle( new ReleaseContainerEvent(container)); }
@SuppressWarnings("unchecked") @Override public void transition(ContainerImpl container, ContainerEvent event) { // Kill the process/process-grp container.setIsReInitializing(false); container.dispatcher.getEventHandler().handle( new ContainersLauncherEvent(container, ContainersLauncherEventType.CLEANUP_CONTAINER)); } }
@Override public void transition(LocalizedResource rsrc, ResourceEvent event) { // notify waiting containers ResourceRequestEvent reqEvent = (ResourceRequestEvent) event; ContainerId container = reqEvent.getContext().getContainerId(); rsrc.ref.add(container); rsrc.dispatcher.getEventHandler().handle( new ContainerResourceLocalizedEvent( container, rsrc.rsrc, rsrc.localPath)); } }
@Override public void transition(LocalizedResource rsrc, ResourceEvent event) { ResourceFailedLocalizationEvent failedEvent = (ResourceFailedLocalizationEvent) event; Queue<ContainerId> containers = rsrc.ref; for (ContainerId container : containers) { rsrc.dispatcher.getEventHandler().handle( new ContainerResourceFailedEvent(container, failedEvent .getLocalResourceRequest(), failedEvent.getDiagnosticMessage())); } } }
@SuppressWarnings(value = "unchecked") @Override public void notifyFatalError(String errorMessage) { rm.getRMContext().getDispatcher().getEventHandler().handle( new RMFatalEvent(RMFatalEventType.EMBEDDED_ELECTOR_FAILED, errorMessage)); }
@Override public void transition(LocalizedResource rsrc, ResourceEvent event) { ResourceRequestEvent req = (ResourceRequestEvent) event; LocalizerContext ctxt = req.getContext(); ContainerId container = ctxt.getContainerId(); rsrc.ref.add(container); rsrc.dispatcher.getEventHandler().handle( new LocalizerResourceRequestEvent(rsrc, req.getVisibility(), ctxt, req.getLocalResourceRequest().getPattern())); } }
@Override public void transition(ApplicationImpl app, ApplicationEvent event) { // Inform the logService app.dispatcher.getEventHandler().handle( new LogHandlerAppFinishedEvent(app.appId)); app.context.getNMTokenSecretManager().appFinished(app.getAppId()); updateCollectorStatus(app); } }
@SuppressWarnings("unchecked") public void containerFinished(RMContainer container, long finishedTime) { if (publishSystemMetrics) { dispatcher.getEventHandler().handle( new ContainerFinishedEvent( container.getContainerId(), container.getDiagnosticsInfo(), container.getContainerExitStatus(), container.getContainerState(), finishedTime, container.getAllocatedNode())); } }
@SuppressWarnings("unchecked") public void containerStarted(RMContainer container) { if (historyServiceEnabled) { dispatcher.getEventHandler().handle( new WritingContainerStartEvent(container.getContainerId(), ContainerStartData.newInstance(container.getContainerId(), container.getAllocatedResource(), container.getAllocatedNode(), container.getAllocatedPriority(), container.getCreationTime()))); } }
@SuppressWarnings("unchecked") public void containerStarted(RMContainer container) { if (historyServiceEnabled) { dispatcher.getEventHandler().handle( new WritingContainerStartEvent(container.getContainerId(), ContainerStartData.newInstance(container.getContainerId(), container.getAllocatedResource(), container.getAllocatedNode(), container.getAllocatedPriority(), container.getCreationTime()))); } }
@SuppressWarnings("unchecked") public void applicationStarted(RMApp app) { if (historyServiceEnabled) { dispatcher.getEventHandler().handle( new WritingApplicationStartEvent(app.getApplicationId(), ApplicationStartData.newInstance(app.getApplicationId(), app.getName(), app.getApplicationType(), app.getQueue(), app.getUser(), app.getSubmitTime(), app.getStartTime()))); } }
public void sendAMLaunchFailed(ApplicationAttemptId appAttemptId) throws Exception { MockAM am = new MockAM(getRMContext(), masterService, appAttemptId); waitForState(am.getApplicationAttemptId(), RMAppAttemptState.ALLOCATED); getRMContext().getDispatcher().getEventHandler() .handle(new RMAppAttemptEvent(appAttemptId, RMAppAttemptEventType.LAUNCH_FAILED, "Failed")); drainEventsImplicitly(); }