Exemple #1
0
        internal ThreadPool(Group group, ThreadGroup parentThreadGroup)
        {
            _threadFactory = new GroupedDaemonThreadFactory(group, parentThreadGroup);
            _executor      = group.buildExecutorService(_threadFactory);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: registry = new java.util.concurrent.ConcurrentHashMap<>();
            _registry = new ConcurrentDictionary <object, Future <object> >();
        }
        protected internal CentralJobScheduler()
        {
            _workStealingExecutors = new ConcurrentDictionary <Group, ExecutorService>(1);
            _topLevelGroup         = new TopLevelGroup();
            _pools = new ThreadPoolManager(_topLevelGroup);
            ThreadFactory threadFactory = new GroupedDaemonThreadFactory(Group.TASK_SCHEDULER, _topLevelGroup);

            _scheduler = new TimeBasedTaskScheduler(Clocks.nanoClock(), _pools);

            // The scheduler thread runs at slightly elevated priority for timeliness, and is started in init().
            _schedulerThread = threadFactory.newThread(_scheduler);
            int priority = Thread.NORM_PRIORITY + 1;

            _schedulerThread.Priority = priority;
        }
 private ExecutorService CreateNewWorkStealingExecutor(Group group, int parallelism, bool asyncMode)
 {
     ForkJoinPool.ForkJoinWorkerThreadFactory factory = new GroupedDaemonThreadFactory(group, _topLevelGroup);
     return(new ForkJoinPool(parallelism, factory, null, asyncMode));
 }