Commit c93c3d2
committed
Fix processQueue concurrent execution resulting in too many concurrent requests
processQueue may be invoked from multiple threads as requests complete or new requests are submitted.
The check of `inProcess.size()` and inProcess.put are not atomic, meaning multiple threads may see capacity then overflow that capacity with new requests.
This fix adds a synchronized block. A non-blocking ReschedulingOperation solution was also considered, but in theory this function should block for a version short period, making simple synchronization potentially a better option.1 parent dad1ca2 commit c93c3d2
File tree
1 file changed
+5
-3
lines changed- client/src/main/java/org/threadly/litesockets/client/http
1 file changed
+5
-3
lines changedLines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
373 | | - | |
374 | | - | |
375 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
376 | 378 | | |
377 | 379 | | |
378 | 380 | | |
| |||
0 commit comments