/** * <p> * Create a new instance of the executor service. <code>dispose()</code> must be called * when done with the instance. This should be done in a try-finally or strong * equivalent, such as <code>Servlet.destroy()</code>. * </p> * <p> * Internally, threads are shared between executor instances. The threads are only * shutdown when the last executor is disposed. * </p> * * @see #dispose() */ public Executors() { int availableProcessors = RuntimeUtils.getAvailableProcessors(); // Always one for single CPU system preferredConcurrency = availableProcessors==1 ? 1 : (availableProcessors * THREADS_PER_PROCESSOR); // Increment activeCount while looking for wraparound assert activeCount.get() >= 0; int newActiveCount = activeCount.incrementAndGet(); if(newActiveCount < 0) { activeCount.decrementAndGet(); throw new IllegalStateException("activeCount integer wraparound detected"); } if(logger.isLoggable(Level.FINE)) logger.log(Level.FINE, "activeCount={0}", newActiveCount); // Use sequential executor on single-CPU systems perProcessor = preferredConcurrency==1 ? null : new PerProcessorExecutor(this); } // </editor-fold>
executor==null || size < MIN_CONCURRENCY_SIZE || (numProcessors = RuntimeUtils.getAvailableProcessors())<MIN_CONCURRENCY_PROCESSORS ) { radixSort(
executor==null || size < MIN_CONCURRENCY_SIZE || (numProcessors = RuntimeUtils.getAvailableProcessors())<MIN_CONCURRENCY_PROCESSORS ) { radixSort(
executor==null || size < MIN_CONCURRENCY_SIZE || (numProcessors = RuntimeUtils.getAvailableProcessors())<MIN_CONCURRENCY_PROCESSORS ) { radixSort(
executor==null || size < MIN_CONCURRENCY_SIZE || (numProcessors = RuntimeUtils.getAvailableProcessors())<MIN_CONCURRENCY_PROCESSORS ) { radixSort(