Commit c37a247
Fix borrowObject timeout wrapping (#3666)
* Fix borrowObject timeout wrapping #3623
Override borrowObject(long borrowMaxWaitMillis) in GenericObjectPool
to apply connection wrapping when borrowing with timeout. This ensures
connections borrowed with timeout are properly returned to the pool
when closed via try-with-resources.
Without this fix, borrowObject(timeout) returns unwrapped connections
that don't auto-return to pool, causing connection leaks.
* Add borrowObject(Duration) override and test #3623
Override borrowObject(Duration) in GenericObjectPool to apply connection
wrapping, ensuring connections borrowed with Duration timeout are properly
returned to pool when closed via try-with-resources.
Add integration test following the same pattern as borrowObject(long) test.
* Rename test methods for clarity
Rename borrowObject test methods to be more explicit:
- genericPoolShouldWorkWithBorrowObjectTimeout -> TimeoutMillis
- genericPoolShouldWorkWithBorrowObjectDuration -> TimeoutDuration
This makes it clearer which parameter type each test covers.
* Fix tests
* Override only the Duration borrow method
---------
Co-authored-by: aleksandar.todorov <a_t_todorov@yahoo.com>1 parent ec2f2b9 commit c37a247
2 files changed
Lines changed: 39 additions & 3 deletions
File tree
- src
- main/java/io/lettuce/core/support
- test/java/io/lettuce/core/support
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
147 | | - | |
148 | | - | |
149 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
150 | 153 | | |
151 | 154 | | |
152 | 155 | | |
| |||
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
406 | 407 | | |
407 | 408 | | |
408 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
409 | 442 | | |
410 | 443 | | |
411 | 444 | | |
| |||
0 commit comments