Package org.asynchttpclient.filter
Class ReleasePermitOnComplete
- java.lang.Object
-
- org.asynchttpclient.filter.ReleasePermitOnComplete
-
public final class ReleasePermitOnComplete extends Object
Wrapper forAsyncHandlers to release a permit once onAsyncHandler.onCompleted()orAsyncHandler.onThrowable(Throwable). This is done via a dynamic proxy to preserve all interfaces of the wrapped handler.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> AsyncHandler<T>wrap(AsyncHandler<T> handler, Semaphore available)Wrap handler to release the semaphore permit once when the wrapped handler terminates.
-
-
-
Method Detail
-
wrap
public static <T> AsyncHandler<T> wrap(AsyncHandler<T> handler, Semaphore available)
Wrap handler to release the semaphore permit once when the wrapped handler terminates.- Type Parameters:
T- the handler result type- Parameters:
handler- the handler to be wrappedavailable- the Semaphore to be released when the wrapped handler terminates- Returns:
- the wrapped handler
-
-