public override void Handle(LocalizationEvent @event)
 {
 }
Пример #2
0
            public override void Handle(LocalizationEvent @event)
            {
                switch (@event.GetType())
                {
                case LocalizationEventType.InitApplicationResources:
                {
                    Org.Apache.Hadoop.Yarn.Server.Nodemanager.Containermanager.Application.Application
                                                               app = ((ApplicationLocalizationEvent)@event).GetApplication();
                    // Simulate event from ApplicationLocalization.
                    this.dispatcher.GetEventHandler().Handle(new ApplicationInitedEvent(app.GetAppId(
                                                                                            )));
                    break;
                }

                case LocalizationEventType.InitContainerResources:
                {
                    ContainerLocalizationRequestEvent rsrcReqs = (ContainerLocalizationRequestEvent)@event;
                    // simulate localization of all requested resources
                    foreach (ICollection <LocalResourceRequest> rc in rsrcReqs.GetRequestedResources()
                             .Values)
                    {
                        foreach (LocalResourceRequest req in rc)
                        {
                            Org.Apache.Hadoop.Yarn.Server.Nodemanager.DummyContainerManager.Log.Info("DEBUG: "
                                                                                                     + req + ":" + rsrcReqs.GetContainer().GetContainerId());
                            this.dispatcher.GetEventHandler().Handle(new ContainerResourceLocalizedEvent(rsrcReqs
                                                                                                         .GetContainer().GetContainerId(), req, new Path("file:///local" + req.GetPath().
                                                                                                                                                         ToUri().GetPath())));
                        }
                    }
                    break;
                }

                case LocalizationEventType.CleanupContainerResources:
                {
                    Org.Apache.Hadoop.Yarn.Server.Nodemanager.Containermanager.Container.Container container
                        = ((ContainerLocalizationEvent)@event).GetContainer();
                    // TODO: delete the container dir
                    this.dispatcher.GetEventHandler().Handle(new ContainerEvent(container.GetContainerId
                                                                                    (), ContainerEventType.ContainerResourcesCleanedup));
                    break;
                }

                case LocalizationEventType.DestroyApplicationResources:
                {
                    Org.Apache.Hadoop.Yarn.Server.Nodemanager.Containermanager.Application.Application
                        application = ((ApplicationLocalizationEvent)@event).GetApplication();
                    // decrement reference counts of all resources associated with this
                    // app
                    this.dispatcher.GetEventHandler().Handle(new ApplicationEvent(application.GetAppId
                                                                                      (), ApplicationEventType.ApplicationResourcesCleanedup));
                    break;
                }

                default:
                {
                    NUnit.Framework.Assert.Fail("Unexpected event: " + @event.GetType());
                    break;
                }
                }
            }