Exemplo n.º 1
0
			/// <exception cref="System.Exception"/>
			public override void OperationComplete(ChannelFuture future)
			{
				if (!future.IsSuccess())
				{
					future.GetChannel().Close();
					return;
				}
				int waitCount = this.reduceContext.GetMapsToWait().DecrementAndGet();
				if (waitCount == 0)
				{
					this._enclosing.metrics.OperationComplete(future);
					future.GetChannel().Close();
				}
				else
				{
					this._enclosing.pipelineFact.GetSHUFFLE().SendMap(this.reduceContext);
				}
			}
Exemplo n.º 2
0
        public virtual void Run()
        {
            // Configure the client.
            ChannelFactory factory = new NioClientSocketChannelFactory(Executors.NewCachedThreadPool
                                                                           (), Executors.NewCachedThreadPool(), 1, 1);
            ClientBootstrap bootstrap = new ClientBootstrap(factory);

            // Set up the pipeline factory.
            bootstrap.SetPipelineFactory(SetPipelineFactory());
            bootstrap.SetOption("tcpNoDelay", true);
            bootstrap.SetOption("keepAlive", true);
            // Start the connection attempt.
            ChannelFuture future = bootstrap.Connect(new IPEndPoint(host, port));

            if (oneShot)
            {
                // Wait until the connection is closed or the connection attempt fails.
                future.GetChannel().GetCloseFuture().AwaitUninterruptibly();
                // Shut down thread pools to exit.
                bootstrap.ReleaseExternalResources();
            }
        }