PortalExecutorConfig implements Serializable { public PortalExecutorConfig( String name, int corePoolSize, int maxPoolSize, long keepAliveTime, TimeUnit timeUnit, int maxQueueSize, ThreadFactory threadFactory, RejectedExecutionHandler rejectedExecutionHandler, ThreadPoolHandler threadPoolHandler) { if (corePoolSize < 1) { throw new IllegalArgumentException( "To ensure FIFO, core pool size must be 1 or greater"); } _name = name; _corePoolSize = corePoolSize; _maxPoolSize = maxPoolSize; _keepAliveTime = keepAliveTime; _timeUnit = timeUnit; _maxQueueSize = maxQueueSize; _threadFactory = threadFactory; _rejectedExecutionHandler = rejectedExecutionHandler; _threadPoolHandler = threadPoolHandler; } PortalExecutorConfig(
		String name, int corePoolSize, int maxPoolSize, long keepAliveTime,
		TimeUnit timeUnit, int maxQueueSize, ThreadFactory threadFactory,
		RejectedExecutionHandler rejectedExecutionHandler,
		ThreadPoolHandler threadPoolHandler); int getCorePoolSize(); long getKeepAliveTime(); int getMaxPoolSize(); int getMaxQueueSize(); String getName(); RejectedExecutionHandler getRejectedExecutionHandler(); ThreadFactory getThreadFactory(); ThreadPoolHandler getThreadPoolHandler(); TimeUnit getTimeUnit();  }
@Test public void testPortalExecutorConfig() { try { new PortalExecutorConfig(null, 0, 0, 0, null, 0, null, null, null); Assert.fail(); } catch (IllegalArgumentException illegalArgumentException) { Assert.assertEquals( "To ensure FIFO, core pool size must be 1 or greater", illegalArgumentException.getMessage()); } String name = "name"; int corePoolSize = 1; int maxPoolSize = 2; long keepAliveTime = 3; TimeUnit timeUnit = TimeUnit.HOURS; int maxQueueSize = 4; ThreadFactory threadFactory = runnable -> null; RejectedExecutionHandler rejectedExecutionHandler = new ThreadPoolExecutor.AbortPolicy(); ThreadPoolHandler threadPoolHandler = new ThreadPoolHandler() { @Override public void afterExecute(Runnable runnable, Throwable throwable) { } @Override public void beforeExecute(Thread thread, Runnable runnable) { } @Override public void terminated() { } }; PortalExecutorConfig portalExecutorConfig = new PortalExecutorConfig( name, corePoolSize, maxPoolSize, keepAliveTime, timeUnit, maxQueueSize, threadFactory, rejectedExecutionHandler, threadPoolHandler); Assert.assertSame(name, portalExecutorConfig.getName()); Assert.assertSame(corePoolSize, portalExecutorConfig.getCorePoolSize()); Assert.assertSame(maxPoolSize, portalExecutorConfig.getMaxPoolSize()); Assert.assertSame( keepAliveTime, portalExecutorConfig.getKeepAliveTime()); Assert.assertSame(timeUnit, portalExecutorConfig.getTimeUnit()); Assert.assertSame(maxQueueSize, portalExecutorConfig.getMaxQueueSize()); Assert.assertSame( threadFactory, portalExecutorConfig.getThreadFactory()); Assert.assertSame( rejectedExecutionHandler, portalExecutorConfig.getRejectedExecutionHandler()); Assert.assertSame( threadPoolHandler, portalExecutorConfig.getThreadPoolHandler()); }