You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Motivation:
Fix for AsyncHttpClient#1314 introduced a regression where the Semaphore leaks and is
not released on Throwable.
Modification:
Release Semaphore when called handler method is onThrowable too, not
only onComplete.
Result
No more Semaphore leak
Copy file name to clipboardExpand all lines: client/src/main/java/org/asynchttpclient/filter/ReleasePermitOnComplete.java
+11-3Lines changed: 11 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -11,13 +11,16 @@
11
11
importorg.asynchttpclient.AsyncHandler;
12
12
13
13
/**
14
-
* Wrapper for {@link AsyncHandler}s to release a permit on {@link AsyncHandler#onCompleted()}.
15
-
* This is done via a dynamic proxy to preserve all interfaces of the wrapped handler.
14
+
* Wrapper for {@link AsyncHandler}s to release a permit on {@link AsyncHandler#onCompleted()}. This is done via a dynamic proxy to preserve all interfaces of the wrapped handler.
16
15
*/
17
16
publicclassReleasePermitOnComplete {
18
17
19
18
/**
20
19
* Wrap handler to release the permit of the semaphore on {@link AsyncHandler#onCompleted()}.
20
+
*
21
+
* @param handler the handler to be wrapped
22
+
* @param available the Semaphore to be released when the wrapped handler is completed
0 commit comments