Skip to content

Commit ef86698

Browse files
author
Stephane Landelle
committed
Merge pull request AsyncHttpClient#503 from rschildmeijer/master
Make the fairness semantics of the ThrottleRequestFilter configurable
2 parents c0ecce0 + 3df41bf commit ef86698

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

api/src/main/java/org/asynchttpclient/extra/ThrottleRequestFilter.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ public ThrottleRequestFilter(int maxConnections) {
3535
}
3636

3737
public ThrottleRequestFilter(int maxConnections, int maxWait) {
38-
this.maxWait = maxWait;
39-
available = new Semaphore(maxConnections, true);
38+
this(maxConnections, maxWait, false);
39+
}
40+
41+
public ThrottleRequestFilter(int maxConnections, int maxWait, boolean fair) {
42+
this.maxWait = maxWait;
43+
available = new Semaphore(maxConnections, fair);
4044
}
4145

4246
/**

0 commit comments

Comments
 (0)