Beispiel #1
0
		// TODO change AbstractService to throw InterruptedException
		/// <exception cref="System.Exception"/>
		protected override void ServiceStart()
		{
			Configuration conf = GetConfig();
			userRsrc = new ConcurrentHashMap<string, string>();
			secretManager = new JobTokenSecretManager();
			RecoverState(conf);
			ServerBootstrap bootstrap = new ServerBootstrap(selector);
			try
			{
				pipelineFact = new ShuffleHandler.HttpPipelineFactory(this, conf);
			}
			catch (Exception ex)
			{
				throw new RuntimeException(ex);
			}
			bootstrap.SetOption("child.keepAlive", true);
			bootstrap.SetPipelineFactory(pipelineFact);
			port = conf.GetInt(ShufflePortConfigKey, DefaultShufflePort);
			Org.Jboss.Netty.Channel.Channel ch = bootstrap.Bind(new IPEndPoint(port));
			accepted.AddItem(ch);
			port = ((IPEndPoint)ch.GetLocalAddress()).Port;
			conf.Set(ShufflePortConfigKey, Sharpen.Extensions.ToString(port));
			pipelineFact.Shuffle.SetPort(port);
			Log.Info(GetName() + " listening on port " + port);
			base.ServiceStart();
			sslFileBufferSize = conf.GetInt(SuffleSslFileBufferSizeKey, DefaultSuffleSslFileBufferSize
				);
			connectionKeepAliveEnabled = conf.GetBoolean(ShuffleConnectionKeepAliveEnabled, DefaultShuffleConnectionKeepAliveEnabled
				);
			connectionKeepAliveTimeOut = Math.Max(1, conf.GetInt(ShuffleConnectionKeepAliveTimeOut
				, DefaultShuffleConnectionKeepAliveTimeOut));
			mapOutputMetaInfoCacheSize = Math.Max(1, conf.GetInt(ShuffleMapoutputMetaInfoCacheSize
				, DefaultShuffleMapoutputMetaInfoCacheSize));
		}
Beispiel #2
0
        public virtual void Run()
        {
            // Configure the Server.
            ChannelFactory factory;

            if (workerCount == 0)
            {
                // Use default workers: 2 * the number of available processors
                factory = new NioServerSocketChannelFactory(Executors.NewCachedThreadPool(), Executors
                                                            .NewCachedThreadPool());
            }
            else
            {
                factory = new NioServerSocketChannelFactory(Executors.NewCachedThreadPool(), Executors
                                                            .NewCachedThreadPool(), workerCount);
            }
            server = new ServerBootstrap(factory);
            server.SetPipelineFactory(new _ChannelPipelineFactory_73(this));
            server.SetOption("child.tcpNoDelay", true);
            server.SetOption("child.keepAlive", true);
            // Listen to TCP port
            ch = server.Bind(new IPEndPoint(port));
            IPEndPoint socketAddr = (IPEndPoint)ch.GetLocalAddress();

            boundPort = socketAddr.Port;
            Log.Info("Started listening to TCP requests at port " + boundPort + " for " + rpcProgram
                     + " with workerCount " + workerCount);
        }
        private ServerBootstrap StartHttpServer(int port, Org.Apache.Hadoop.Security.Token.Token
                                                <DelegationTokenIdentifier> token, URI url)
        {
            ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory
                                                                (Executors.NewCachedThreadPool(), Executors.NewCachedThreadPool()));

            bootstrap.SetPipelineFactory(new _ChannelPipelineFactory_362(token, url));
            bootstrap.Bind(new IPEndPoint("localhost", port));
            return(bootstrap);
        }
Beispiel #4
0
 internal void Start(int idleTimeMilliSeconds, EndPoint tcpAddress, EndPoint udpAddress
                     )
 {
     tcpServer = new ServerBootstrap(new NioServerSocketChannelFactory(Executors.NewCachedThreadPool
                                                                           (), Executors.NewCachedThreadPool()));
     tcpServer.SetPipelineFactory(new _ChannelPipelineFactory_100(this, idleTimeMilliSeconds
                                                                  ));
     udpServer = new ConnectionlessBootstrap(new NioDatagramChannelFactory(Executors.NewCachedThreadPool
                                                                               ()));
     udpServer.SetPipeline(Channels.Pipeline(RpcUtil.StageRpcMessageParser, handler, RpcUtil
                                             .StageRpcUdpResponse));
     tcpChannel = tcpServer.Bind(tcpAddress);
     udpChannel = udpServer.Bind(udpAddress);
     allChannels.AddItem(tcpChannel);
     allChannels.AddItem(udpChannel);
     Log.Info("Portmap server started at tcp://" + tcpChannel.GetLocalAddress() + ", udp://"
              + udpChannel.GetLocalAddress());
 }