@Test public void testCreateObjectPool() throws Exception { GenericObjectPool<ServiceWorkerPool.Worker> pool = createCommonsObjectPool(); assertNotNull(pool); assertEquals(10, pool.getMaxTotal()); assertEquals(10, pool.getMinIdle()); assertEquals(10, pool.getMaxIdle()); assertEquals(-1, pool.getMaxWaitMillis()); assertTrue(pool.getBlockWhenExhausted()); }
public GenericObjectPool<Worker> createCommonsObjectPool() throws CoreException { GenericObjectPool<Worker> pool = new GenericObjectPool<>(new WorkerFactory()); pool.setMaxTotal(maxThreads); pool.setMinIdle(maxThreads); pool.setMaxIdle(maxThreads); pool.setMaxWaitMillis(-1L); pool.setBlockWhenExhausted(true); pool.setSoftMinEvictableIdleTimeMillis(EVICT_RUN); pool.setTimeBetweenEvictionRunsMillis( EVICT_RUN + ThreadLocalRandom.current().nextLong(EVICT_RUN)); return pool; }
ServiceWorkerPool { public GenericObjectPool<Worker> createCommonsObjectPool() throws CoreException { GenericObjectPool<Worker> pool = new GenericObjectPool<>(new WorkerFactory()); pool.setMaxTotal(maxThreads); pool.setMinIdle(maxThreads); pool.setMaxIdle(maxThreads); pool.setMaxWaitMillis(-1L); pool.setBlockWhenExhausted(true); pool.setSoftMinEvictableIdleTimeMillis(EVICT_RUN); pool.setTimeBetweenEvictionRunsMillis( EVICT_RUN + ThreadLocalRandom.current().nextLong(EVICT_RUN)); return pool; } }
ServiceWorkerPool { public GenericObjectPool<Worker> createCommonsObjectPool() throws CoreException { GenericObjectPool<Worker> pool = new GenericObjectPool<>(new WorkerFactory()); pool.setMaxTotal(maxThreads); pool.setMinIdle(maxThreads); pool.setMaxIdle(maxThreads); pool.setMaxWaitMillis(-1L); pool.setBlockWhenExhausted(true); pool.setSoftMinEvictableIdleTimeMillis(EVICT_RUN); pool.setTimeBetweenEvictionRunsMillis( EVICT_RUN + ThreadLocalRandom.current().nextLong(EVICT_RUN)); return pool; } ServiceWorkerPool(Service s, EventHandler eh, int maxThreads); }
ServiceWorkerPool { public GenericObjectPool<Worker> createCommonsObjectPool() throws CoreException { GenericObjectPool<Worker> pool = new GenericObjectPool<>(new WorkerFactory()); pool.setMaxTotal(maxThreads); pool.setMinIdle(maxThreads); pool.setMaxIdle(maxThreads); pool.setMaxWaitMillis(-1L); pool.setBlockWhenExhausted(true); pool.setSoftMinEvictableIdleTimeMillis(EVICT_RUN); pool.setTimeBetweenEvictionRunsMillis( EVICT_RUN + ThreadLocalRandom.current().nextLong(EVICT_RUN)); return pool; } ServiceWorkerPool(Service s, EventHandler eh, int maxThreads); GenericObjectPool<Worker> createCommonsObjectPool(); ExecutorService createExecutor(String prefix); @Deprecated static void closeQuietly(ObjectPool<?> pool); void warmup(final GenericObjectPool<Worker> objectPool); }
ServiceWorkerPool { public GenericObjectPool<Worker> createCommonsObjectPool() throws CoreException { GenericObjectPool<Worker> pool = new GenericObjectPool<>(new WorkerFactory()); pool.setMaxTotal(maxThreads); pool.setMinIdle(maxThreads); pool.setMaxIdle(maxThreads); pool.setMaxWaitMillis(-1L); pool.setBlockWhenExhausted(true); pool.setSoftMinEvictableIdleTimeMillis(EVICT_RUN); pool.setTimeBetweenEvictionRunsMillis( EVICT_RUN + ThreadLocalRandom.current().nextLong(EVICT_RUN)); return pool; } ServiceWorkerPool(Service s, EventHandler eh, int maxThreads); GenericObjectPool<Worker> createCommonsObjectPool(); ExecutorService createExecutor(String prefix); @Deprecated static void closeQuietly(ObjectPool<?> pool); void warmup(final GenericObjectPool<Worker> objectPool);  }