Pool { public void refresh() { logger.info("refresh resource pool, pool={}", name); evictIdleItems(); replenish(); } Pool(Supplier<T> factory, String name); void size(int minSize, int maxSize); void checkoutTimeout(Duration timeout); void validator(ResourceValidator<T> validator, Duration aliveWindow); PoolItem<T> borrowItem(); void returnItem(PoolItem<T> item); void refresh(); void close(); public Duration maxIdleTime; }
@Test void refresh() { pool.size(2, 2); pool.refresh(); assertThat(pool.size.get()).isEqualTo(2); assertThat(pool.idleItems.size()).isEqualTo(2); }