Skip to content

Commit eb44c26

Browse files
committed
Can't make DefaultPooledObjectInfo.getPooledObject() public here.
1 parent 864bf0c commit eb44c26

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/main/java/org/apache/commons/pool2/impl/DefaultPooledObjectInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public String getLastReturnTimeFormatted() {
9393
* @return the pooled object for debugging, use at your own risk, changing the state of this object may have unintended consequences for the pool.
9494
* @since 2.14.0
9595
*/
96-
public PooledObject<?> getPooledObject() {
96+
PooledObject<?> getPooledObject() {
9797
return pooledObject;
9898
}
9999

src/test/java/org/apache/commons/pool2/impl/TestBaseGenericObjectPool.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import static org.junit.jupiter.api.Assertions.assertEquals;
2121
import static org.junit.jupiter.api.Assertions.assertFalse;
22+
import static org.junit.jupiter.api.Assertions.assertNotNull;
2223
import static org.junit.jupiter.api.Assertions.assertTrue;
2324

2425
import java.lang.management.ManagementFactory;
@@ -219,8 +220,7 @@ void testEvictionTimerMultiplePools() throws InterruptedException {
219220
}
220221

221222
/**
222-
* POOL-393
223-
* Tests JMX registration does not add too much latency to pool creation.
223+
* POOL-393: Tests JMX registration does not add too much latency to pool creation.
224224
*/
225225
@SuppressWarnings("resource") // pools closed in finally block
226226
@Test
@@ -232,7 +232,9 @@ void testJMXRegistrationLatency() {
232232
try {
233233
// final long startTime = System.currentTimeMillis();
234234
for (int i = 0; i < numPools; i++) {
235-
pools.add(new GenericObjectPool<>(new WaiterFactory<>(0, 0, 0, 0, 0, 0), new GenericObjectPoolConfig<>()));
235+
final GenericObjectPool<Waiter> gop = new GenericObjectPool<>(new WaiterFactory<>(0, 0, 0, 0, 0, 0), new GenericObjectPoolConfig<>());
236+
assertNotNull(gop.getJmxName());
237+
pools.add(gop);
236238
}
237239
// System.out.println("Duration: " + (System.currentTimeMillis() - startTime));
238240
final ObjectName oname = pools.get(numPools - 1).getJmxName();

0 commit comments

Comments
 (0)