File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed
src/test/java/org/apache/commons/pool3/impl Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -3197,25 +3197,31 @@ void testPool419() throws Exception{
31973197
31983198 List <Object > poolObjects = new ArrayList <>();
31993199
3200- List <FutureTask < Boolean > > tasks = new ArrayList <>();
3200+ List <Runnable > tasks = new ArrayList <>();
32013201
32023202 for (int i = 0 ; i < maxConnections ; i ++) {
32033203 poolObjects .add (connectionPool .borrowObject ());
32043204 }
32053205
32063206 for (Object poolObject : poolObjects ) {
32073207
3208- tasks .add (new FutureTask <>(() -> {
3209- startLatch .await ();
3210- connectionPool .invalidateObject (poolObject );
3211- return true ;
3212- }));
3213-
3214- tasks .add (new FutureTask <>(() -> {
3215- startLatch .await ();
3216- connectionPool .returnObject (poolObject );
3217- return true ;
3218- }));
3208+ tasks .add (() -> {
3209+ try {
3210+ startLatch .await ();
3211+ connectionPool .invalidateObject (poolObject );
3212+ } catch (InterruptedException e ) {
3213+ Thread .currentThread ().interrupt (); // Restore interrupt status
3214+ }
3215+ });
3216+
3217+ tasks .add (() -> {
3218+ try {
3219+ startLatch .await ();
3220+ connectionPool .returnObject (poolObject );
3221+ } catch (InterruptedException e ) {
3222+ Thread .currentThread ().interrupt (); // Restore interrupt status
3223+ }
3224+ });
32193225 }
32203226
32213227 tasks .forEach (executor ::submit );
You can’t perform that action at this time.
0 commit comments