Skip to content

Commit 77bf3be

Browse files
committed
Make the fairness semantics of the ThrottleRequestFilter configurable
1 parent 608972c commit 77bf3be

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, true);
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)