Esempio n. 1
0
            public override void Run()
            {
                NMClientAsyncImpl.ContainerEvent @event   = null;
                ICollection <string>             allNodes = new HashSet <string>();

                while (!this._enclosing.stopped.Get() && !Sharpen.Thread.CurrentThread().IsInterrupted
                           ())
                {
                    try
                    {
                        @event = this._enclosing.events.Take();
                    }
                    catch (Exception e)
                    {
                        if (!this._enclosing.stopped.Get())
                        {
                            Org.Apache.Hadoop.Yarn.Client.Api.Async.Impl.NMClientAsyncImpl.Log.Error("Returning, thread interrupted"
                                                                                                     , e);
                        }
                        return;
                    }
                    allNodes.AddItem(@event.GetNodeId().ToString());
                    int threadPoolSize = this._enclosing.threadPool.GetCorePoolSize();
                    if (threadPoolSize != this._enclosing.maxThreadPoolSize)
                    {
                        int nodeNum             = allNodes.Count;
                        int idealThreadPoolSize = Math.Min(this._enclosing.maxThreadPoolSize, nodeNum);
                        if (threadPoolSize < idealThreadPoolSize)
                        {
                            int newThreadPoolSize = Math.Min(this._enclosing.maxThreadPoolSize, idealThreadPoolSize
                                                             + Org.Apache.Hadoop.Yarn.Client.Api.Async.Impl.NMClientAsyncImpl.InitialThreadPoolSize
                                                             );
                            Org.Apache.Hadoop.Yarn.Client.Api.Async.Impl.NMClientAsyncImpl.Log.Info("Set NMClientAsync thread pool size to "
                                                                                                    + newThreadPoolSize + " as the number of nodes to talk to is " + nodeNum);
                            this._enclosing.threadPool.SetCorePoolSize(newThreadPoolSize);
                        }
                    }
                    this._enclosing.threadPool.Execute(this._enclosing.GetContainerEventProcessor(@event
                                                                                                  ));
                }
            }
Esempio n. 2
0
 protected internal override NMClientAsyncImpl.ContainerEventProcessor GetContainerEventProcessor
     (NMClientAsyncImpl.ContainerEvent @event)
 {
     return(new TestNMClientAsync.MockNMClientAsync2.MockContainerEventProcessor(this,
                                                                                 @event));
 }
Esempio n. 3
0
 public MockContainerEventProcessor(MockNMClientAsync2 _enclosing, NMClientAsyncImpl.ContainerEvent
                                    @event)
     : base(_enclosing)
 {
     this._enclosing = _enclosing;
 }
Esempio n. 4
0
 public ContainerEventProcessor(NMClientAsyncImpl _enclosing, NMClientAsyncImpl.ContainerEvent
                                @event)
 {
     this._enclosing = _enclosing;
     this.@event     = @event;
 }
Esempio n. 5
0
 protected internal virtual NMClientAsyncImpl.ContainerEventProcessor GetContainerEventProcessor
     (NMClientAsyncImpl.ContainerEvent @event)
 {
     return(new NMClientAsyncImpl.ContainerEventProcessor(this, @event));
 }