public static int determineNumberOfWorkerThreads ( ) { final int threads = Config . getInstance ( ) . getPropertyAsInt ( Config . AlpineKey . WORKER_THREADS ) ; if ( threads > 0 ) { return threads ; } else if ( threads == 0 ) { final int cores = SystemUtil . getCpuCores ( ) ; final int multiplier = Config . getInstance ( ) . getPropertyAsInt ( Config . AlpineKey . WORKER_THREAD_MULTIPLIER ) ; if ( multiplier > 0 ) { return cores * multiplier ; } else { return cores ; } } return 1 ; // We have to have a minimum of 1 thread }
Calculates the number of worker threads to use . Minimum return value is 1 .