public void ensureMinimumBuildThreadLimit ( int minLimit ) { if ( buildThreadLimit . get ( ) < minLimit ) { synchronized ( buildThreadLock ) { buildThreadLimit . set ( minLimit ) ; ThreadPoolExecutor buildExecutor = executors . get ( TaskResult . ResultType . BUILD ) ; // Must set both the maximum and the core limits. If the core is // not set, then the thread pool will not be forced to expand to // the minimum number of threads required. buildExecutor . setMaximumPoolSize ( minLimit ) ; buildExecutor . setCorePoolSize ( minLimit ) ; } } }
Ensures that the number of threads in the build pool is at least as large as the number given . Because object templates can have dependencies on each other it is possible to deadlock the compilation with a rigidly fixed build queue . To avoid this allow the build queue limit to be increased .