Fix test formatting, replace deprecated method in new test cases.
@@ -2475,8 +2475,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
}
/**
- * POOL-391
- * Adapted from code in the JIRA ticket.
+ * POOL-391 Adapted from code in the JIRA ticket.
*
* @throws Exception May occur in some failure modes
*/
@@ -2488,25 +2487,29 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
config.setMinIdlePerKey(0);
config.setMaxIdlePerKey(-1);
config.setMaxTotal(-1);
- config.setMaxWaitMillis(TimeUnit.SECONDS.toMillis(5));
+ config.setMaxWait(Duration.ofMillis(5));
GenericKeyedObjectPool<Integer, Integer> testPool = new GenericKeyedObjectPool<>(
new KeyedPooledObjectFactory<Integer, Integer>() {
@Override
public PooledObject<Integer> makeObject(Integer key) throws Exception {
return new DefaultPooledObject<>(10);
}
+
@Override
public void destroyObject(Integer key, PooledObject<Integer> p) throws Exception {
Thread.sleep(500);
}
+
@Override
public boolean validateObject(Integer key, PooledObject<Integer> p) {
return true;
}
+
@Override
public void activateObject(Integer key, PooledObject<Integer> p) throws Exception {
// do nothing
}
+
@Override
public void passivateObject(Integer key, PooledObject<Integer> p) throws Exception {
// do nothing
@@ -2539,8 +2542,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
}
/**
- * POOL-391
- * Verify that when clear(key) is called with reuseCapacity true,
+ * POOL-391 Verify that when clear(key) is called with reuseCapacity true,
* capacity freed is reused and allocated to most loaded pools.
*
* @throws Exception May occur in some failure modes
@@ -2549,7 +2551,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
public void testClearReuseCapacity() throws Exception {
gkoPool.setMaxTotalPerKey(6);
gkoPool.setMaxTotal(6);
- gkoPool.setMaxWaitMillis(5000);
+ gkoPool.setMaxWait(Duration.ofSeconds(5));
// Create one thread to wait on "one", two on "two", three on "three"
final ArrayList<Thread> testThreads = new ArrayList<>();
testThreads.add(new Thread(new SimpleTestThread<>(gkoPool, "one")));
