@Test public void testCoreLessThanMax(){ DefaultExecutorFactory executorFactory = new DefaultExecutorFactory(getTestName(), 2, 1); ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executorFactory.createExecutorService(); Assert.assertEquals(2, threadPoolExecutor.getCorePoolSize()); Assert.assertEquals(2, threadPoolExecutor.getMaximumPoolSize()); }
@Override public ExecutorService createExecutorService() { int useMaxPoolSize = Math.max(corePoolSize, maxPoolSize); ThreadPoolExecutor executor = new ThreadPoolExecutor( corePoolSize, useMaxPoolSize, keepAliveTime, keepAliveTimeUnit, workQueue, threadFactory != null ? threadFactory : XpipeThreadFactory.create(threadNamePrefix), rejectedExecutionHandler); executor.allowCoreThreadTimeOut(allowCoreThreadTimeOut); return executor; }
DefaultExecutorFactory implements ExecutorFactory { @Override public ExecutorService createExecutorService() { int useMaxPoolSize = Math.max(corePoolSize, maxPoolSize); ThreadPoolExecutor executor = new ThreadPoolExecutor( corePoolSize, useMaxPoolSize, keepAliveTime, keepAliveTimeUnit, workQueue, threadFactory != null ? threadFactory : XpipeThreadFactory.create(threadNamePrefix), rejectedExecutionHandler); executor.allowCoreThreadTimeOut(allowCoreThreadTimeOut); return executor; } }
DefaultExecutorFactory implements ExecutorFactory { @Override public ExecutorService createExecutorService() { int useMaxPoolSize = Math.max(corePoolSize, maxPoolSize); ThreadPoolExecutor executor = new ThreadPoolExecutor( corePoolSize, useMaxPoolSize, keepAliveTime, keepAliveTimeUnit, workQueue, threadFactory != null ? threadFactory : XpipeThreadFactory.create(threadNamePrefix), rejectedExecutionHandler); executor.allowCoreThreadTimeOut(allowCoreThreadTimeOut); return executor; } DefaultExecutorFactory(String threadNamePrefix, int corePoolSize, int maxPoolSize);  DefaultExecutorFactory(String threadNamePrefix, int corePoolSize, int maxPoolSize, RejectedExecutionHandler rejectedExecutionHandler);  DefaultExecutorFactory(String threadNamePrefix, int corePoolSize, boolean allowCoreThreadTimeOut);  DefaultExecutorFactory(String threadNamePrefix, int corePoolSize, boolean allowCoreThreadTimeOut,
                                  int maxPoolSize,
                                  int maxQueueSize, int keepAliveTime, TimeUnit keepAliveTimeUnit, RejectedExecutionHandler rejectedExecutionHandler); }
DefaultExecutorFactory implements ExecutorFactory { @Override public ExecutorService createExecutorService() { int useMaxPoolSize = Math.max(corePoolSize, maxPoolSize); ThreadPoolExecutor executor = new ThreadPoolExecutor( corePoolSize, useMaxPoolSize, keepAliveTime, keepAliveTimeUnit, workQueue, threadFactory != null ? threadFactory : XpipeThreadFactory.create(threadNamePrefix), rejectedExecutionHandler); executor.allowCoreThreadTimeOut(allowCoreThreadTimeOut); return executor; } DefaultExecutorFactory(String threadNamePrefix, int corePoolSize, int maxPoolSize);  DefaultExecutorFactory(String threadNamePrefix, int corePoolSize, int maxPoolSize, RejectedExecutionHandler rejectedExecutionHandler);  DefaultExecutorFactory(String threadNamePrefix, int corePoolSize, boolean allowCoreThreadTimeOut);  DefaultExecutorFactory(String threadNamePrefix, int corePoolSize, boolean allowCoreThreadTimeOut,
                                  int maxPoolSize,
                                  int maxQueueSize, int keepAliveTime, TimeUnit keepAliveTimeUnit, RejectedExecutionHandler rejectedExecutionHandler); static DefaultExecutorFactory createAllowCoreTimeout(String threadNamePrefix); static DefaultExecutorFactory createAllowCoreTimeout(String threadNamePrefix, int corePoolSize); static DefaultExecutorFactory createAllowCoreTimeout(String threadNamePrefix, int corePoolSize, int keepAliveTimeSeconds); static DefaultExecutorFactory createAllowCoreTimeoutAbortPolicy(String threadNamePrefix); static DefaultExecutorFactory createAllowCoreTimeoutAbortPolicy(String threadNamePrefix, int corePoolSize); static DefaultExecutorFactory createAllowCoreTimeoutAbortPolicy(String threadNamePrefix, int corePoolSize, int keepAliveTimeSeconds); @Override ExecutorService createExecutorService(); }
DefaultExecutorFactory implements ExecutorFactory { @Override public ExecutorService createExecutorService() { int useMaxPoolSize = Math.max(corePoolSize, maxPoolSize); ThreadPoolExecutor executor = new ThreadPoolExecutor( corePoolSize, useMaxPoolSize, keepAliveTime, keepAliveTimeUnit, workQueue, threadFactory != null ? threadFactory : XpipeThreadFactory.create(threadNamePrefix), rejectedExecutionHandler); executor.allowCoreThreadTimeOut(allowCoreThreadTimeOut); return executor; } DefaultExecutorFactory(String threadNamePrefix, int corePoolSize, int maxPoolSize);  DefaultExecutorFactory(String threadNamePrefix, int corePoolSize, int maxPoolSize, RejectedExecutionHandler rejectedExecutionHandler);  DefaultExecutorFactory(String threadNamePrefix, int corePoolSize, boolean allowCoreThreadTimeOut);  DefaultExecutorFactory(String threadNamePrefix, int corePoolSize, boolean allowCoreThreadTimeOut,
                                  int maxPoolSize,
                                  int maxQueueSize, int keepAliveTime, TimeUnit keepAliveTimeUnit, RejectedExecutionHandler rejectedExecutionHandler); static DefaultExecutorFactory createAllowCoreTimeout(String threadNamePrefix); static DefaultExecutorFactory createAllowCoreTimeout(String threadNamePrefix, int corePoolSize); static DefaultExecutorFactory createAllowCoreTimeout(String threadNamePrefix, int corePoolSize, int keepAliveTimeSeconds); static DefaultExecutorFactory createAllowCoreTimeoutAbortPolicy(String threadNamePrefix); static DefaultExecutorFactory createAllowCoreTimeoutAbortPolicy(String threadNamePrefix, int corePoolSize); static DefaultExecutorFactory createAllowCoreTimeoutAbortPolicy(String threadNamePrefix, int corePoolSize, int keepAliveTimeSeconds); @Override ExecutorService createExecutorService();  }