예제 #1
0
            public virtual void Run()
            {
                ContainerId containerId = [email protected]();

                NMClientAsyncImpl.Log.Info("Processing Event " + this.@event + " for Container "
                                           + containerId);
                if ([email protected]() == NMClientAsyncImpl.ContainerEventType.QueryContainer)
                {
                    try
                    {
                        ContainerStatus containerStatus = this._enclosing.client.GetContainerStatus(containerId
                                                                                                    , [email protected]());
                        try
                        {
                            this._enclosing.callbackHandler.OnContainerStatusReceived(containerId, containerStatus
                                                                                      );
                        }
                        catch (Exception thr)
                        {
                            // Don't process user created unchecked exception
                            NMClientAsyncImpl.Log.Info("Unchecked exception is thrown from onContainerStatusReceived"
                                                       + " for Container " + [email protected](), thr);
                        }
                    }
                    catch (YarnException e)
                    {
                        this.OnExceptionRaised(containerId, e);
                    }
                    catch (IOException e)
                    {
                        this.OnExceptionRaised(containerId, e);
                    }
                    catch (Exception t)
                    {
                        this.OnExceptionRaised(containerId, t);
                    }
                }
                else
                {
                    NMClientAsyncImpl.StatefulContainer container = this._enclosing.containers[containerId
                                                                    ];
                    if (container == null)
                    {
                        NMClientAsyncImpl.Log.Info("Container " + containerId + " is already stopped or failed"
                                                   );
                    }
                    else
                    {
                        container.Handle(this.@event);
                        if (this._enclosing.IsCompletelyDone(container))
                        {
                            Sharpen.Collections.Remove(this._enclosing.containers, containerId);
                        }
                    }
                }
            }
예제 #2
0
 protected internal virtual bool IsCompletelyDone(NMClientAsyncImpl.StatefulContainer
                                                  container)
 {
     return(container.GetState() == NMClientAsyncImpl.ContainerState.Done || container
            .GetState() == NMClientAsyncImpl.ContainerState.Failed);
 }