示例#1
0
 private ReadaheadPool()
 {
     pool = new ThreadPoolExecutor(PoolSize, MaxPoolSize, 3L, TimeUnit.Seconds, new ArrayBlockingQueue
                                   <Runnable>(Capacity));
     pool.SetRejectedExecutionHandler(new ThreadPoolExecutor.DiscardOldestPolicy());
     pool.SetThreadFactory(new ThreadFactoryBuilder().SetDaemon(true).SetNameFormat("Readahead Thread #%d"
                                                                                    ).Build());
 }
示例#2
0
        /// <exception cref="System.Exception"/>
        protected override void ServiceInit(Configuration conf)
        {
            int threadCount = conf.GetInt(YarnConfiguration.RmAmlauncherThreadCount, YarnConfiguration
                                          .DefaultRmAmlauncherThreadCount);
            ThreadFactory tf = new ThreadFactoryBuilder().SetNameFormat("ApplicationMasterLauncher #%d"
                                                                        ).Build();

            launcherPool = new ThreadPoolExecutor(threadCount, threadCount, 1, TimeUnit.Hours
                                                  , new LinkedBlockingQueue <Runnable>());
            launcherPool.SetThreadFactory(tf);
            Configuration newConf = new YarnConfiguration(conf);

            newConf.SetInt(CommonConfigurationKeysPublic.IpcClientConnectMaxRetriesOnSocketTimeoutsKey
                           , conf.GetInt(YarnConfiguration.RmNodemanagerConnectRetires, YarnConfiguration.DefaultRmNodemanagerConnectRetires
                                         ));
            SetConfig(newConf);
            base.ServiceInit(newConf);
        }