Skip to content

Commit

Permalink
Minor fix.
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand committed Dec 19, 2023
1 parent 647d802 commit e5a4e10
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ public class CallbackDispatcher {
* response.
*/
public Pair<Integer, CompletableFuture<Response>> registerRequest() {
int callbackId = requestId.getAndIncrement();
int callbackId = 0;
do {
callbackId = requestId.getAndIncrement();
} while (responses.containsKey(callbackId));
var future = new CompletableFuture<Response>();
responses.put(callbackId, future);
return Pair.of(callbackId, future);
Expand Down

0 comments on commit e5a4e10

Please sign in to comment.