Skip to content

Commit

Permalink
Do not limit ConcurrencyLimitingClient when maxConcurrency is MAX_VAL…
Browse files Browse the repository at this point in the history
…UE (line#2667)

Motivation:
In `ConcurrencyLimitingClient`, we have separate logic when it's unlimited.
We should take the case where the concurrency is `MAX_VALUE` as unlimited.

Modifications:
- Set the `maxConcurrency` as `0` when it's `Integer.MAX_VALUE`.

Result:
- Less overhead
  • Loading branch information
minwoox committed Apr 16, 2020
1 parent aa96a87 commit 30bd38d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ protected AbstractConcurrencyLimitingClient(Client<I, O> delegate,

validateAll(maxConcurrency, timeout, unit);

this.maxConcurrency = maxConcurrency;
if (maxConcurrency == Integer.MAX_VALUE) {
this.maxConcurrency = 0;
} else {
this.maxConcurrency = maxConcurrency;
}
timeoutMillis = unit.toMillis(timeout);
}

Expand Down

0 comments on commit 30bd38d

Please sign in to comment.