AbstractDynamicConfiguration implements DynamicConfiguration { protected ThreadPoolExecutor getWorkersThreadPool() { return workersThreadPool; } AbstractDynamicConfiguration(URL url);  AbstractDynamicConfiguration(String threadPoolPrefixName,
                                        int threadPoolSize,
                                        long keepAliveTime,
                                        String group,
                                        long timeout); @Override void addListener(String key, String group, ConfigurationListener listener); @Override void removeListener(String key, String group, ConfigurationListener listener); @Override final String getConfig(String key, String group, long timeout); @Override Object getInternalProperty(String key); @Override final void close(); @Override boolean removeConfig(String key, String group); @Override String getDefaultGroup(); @Override long getDefaultTimeout(); static final String PARAM_NAME_PREFIX; static final String THREAD_POOL_PREFIX_PARAM_NAME; static final String DEFAULT_THREAD_POOL_PREFIX; static final String THREAD_POOL_SIZE_PARAM_NAME; static final String THREAD_POOL_KEEP_ALIVE_TIME_PARAM_NAME; static final String GROUP_PARAM_NAME; static final String TIMEOUT_PARAM_NAME; static final int DEFAULT_THREAD_POOL_SIZE; static final long DEFAULT_THREAD_POOL_KEEP_ALIVE_TIME; }
@Test public void testConstructor() { URL url = URL.valueOf("default: .addParameter(THREAD_POOL_PREFIX_PARAM_NAME, "test") .addParameter(THREAD_POOL_SIZE_PARAM_NAME, 10) .addParameter(THREAD_POOL_KEEP_ALIVE_TIME_PARAM_NAME, 100); AbstractDynamicConfiguration configuration = new AbstractDynamicConfiguration(url) { @Override protected String doGetConfig(String key, String group) throws Exception { return null; } @Override protected void doClose() throws Exception { } @Override protected boolean doRemoveConfig(String key, String group) throws Exception { return false; } }; ThreadPoolExecutor threadPoolExecutor = configuration.getWorkersThreadPool(); ThreadFactory threadFactory = threadPoolExecutor.getThreadFactory(); Thread thread = threadFactory.newThread(() -> { }); assertEquals(10, threadPoolExecutor.getCorePoolSize()); assertEquals(10, threadPoolExecutor.getMaximumPoolSize()); assertEquals(100, threadPoolExecutor.getKeepAliveTime(TimeUnit.MILLISECONDS)); assertEquals("test-thread-1", thread.getName()); }