/** Creates the worker thread pool. */ private static void createThreadPool() { if (nprocs == -1) { int n = -1; try { String env = System.getProperty("smile.threads"); if (env != null) { n = Integer.parseInt(env); } } catch (Exception ex) { logger.error("Failed to create multi-core execution thread pool", ex); } if (n < 1) { nprocs = Runtime.getRuntime().availableProcessors(); } else { nprocs = n; } if (nprocs > 1) { threads = (ThreadPoolExecutor) Executors.newFixedThreadPool(nprocs, new SimpleDeamonThreadFactory()); } } }