protected CentralJobScheduler() { workStealingExecutors = new ConcurrentHashMap<>( 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.setPriority( priority ); }
@Before public void setUp() { clock = new FakeClock(); pools = new ThreadPoolManager( new ThreadGroup( "TestPool" ) ); scheduler = new TimeBasedTaskScheduler( clock, pools ); counter = new AtomicInteger(); semaphore = new Semaphore( 0 ); }
protected CentralJobScheduler() { workStealingExecutors = new ConcurrentHashMap<>( 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.setPriority( priority ); }