public virtual void Run() { ContainerLauncherImpl.Log.Info("Processing the event " + [email protected]()); // Load ContainerManager tokens before creating a connection. // TODO: Do it only once per NodeManager. ContainerId containerID = [email protected](); ContainerLauncherImpl.Container c = this._enclosing.GetContainer(this.@event); switch ([email protected]()) { case ContainerLauncher.EventType.ContainerRemoteLaunch: { ContainerRemoteLaunchEvent launchEvent = (ContainerRemoteLaunchEvent)this.@event; c.Launch(launchEvent); break; } case ContainerLauncher.EventType.ContainerRemoteCleanup: { c.Kill(); break; } } this._enclosing.RemoveContainerIfDone(containerID); }
private void RemoveContainerIfDone(ContainerId id) { ContainerLauncherImpl.Container c = containers[id]; if (c != null && c.IsCompletelyDone()) { Sharpen.Collections.Remove(containers, id); } }
private ContainerLauncherImpl.Container GetContainer(ContainerLauncherEvent @event ) { ContainerId id = @event.GetContainerID(); ContainerLauncherImpl.Container c = containers[id]; if (c == null) { c = new ContainerLauncherImpl.Container(this, @event.GetTaskAttemptID(), @event.GetContainerID (), @event.GetContainerMgrAddress()); ContainerLauncherImpl.Container old = containers.PutIfAbsent(id, c); if (old != null) { c = old; } } return(c); }