protected ThreadPoolExecutor createDefaultExecutor(final String name, final int priority, final boolean daemon) { ThreadPoolExecutor rc; if (maxPoolSize == Integer.MAX_VALUE) { rc = new ThreadPoolExecutor(corePoolSize, maxPoolSize, 10, TimeUnit.SECONDS, new SynchronousQueue(), new DefaultThreadFactory(name, daemon, priority)); } else { rc = new ThreadPoolExecutor(corePoolSize, maxPoolSize, 10, TimeUnit.SECONDS, new LinkedBlockingQueue(), new DefaultThreadFactory(name, daemon, priority)); } // FIXME: This API is only in JDK 1.6 - Use reflection? // rc.allowCoreThreadTimeOut(true); return rc; }
protected ThreadPoolExecutor createDefaultExecutor(final String name, final int priority, final boolean daemon) { ThreadPoolExecutor rc; if (maxPoolSize == Integer.MAX_VALUE) { rc = new ThreadPoolExecutor(corePoolSize, maxPoolSize, 10, TimeUnit.SECONDS, new SynchronousQueue(), new DefaultThreadFactory(name, daemon, priority)); } else { rc = new ThreadPoolExecutor(corePoolSize, maxPoolSize, 10, TimeUnit.SECONDS, new LinkedBlockingQueue(), new DefaultThreadFactory(name, daemon, priority)); } // FIXME: This API is only in JDK 1.6 - Use reflection? // rc.allowCoreThreadTimeOut(true); return rc; }