ForkJoinWorkerThread (ForkJoinPool pool) { final int n = setNextBit(); //System.out.println("New FJP thread "+n); ForkJoinWorkerThread thread = new ForkJoinWorkerThread(pool) { @Override protected void onTermination(Throwable exception) { //System.out.println("Exit FJP thread "+n); clearBit(n); super.onTermination(exception); } }; thread.setName("JobScheduler FJ pool " + n + "/" + pool.getParallelism()); thread.setPriority(Thread.NORM_PRIORITY - 1); return thread; }