Package org.forgerock.util
Class CloseSilentlyAsyncFunction<VIN extends Closeable,VOUT,E extends Exception>
- java.lang.Object
-
- org.forgerock.util.CloseSilentlyAsyncFunction<VIN,VOUT,E>
-
- Type Parameters:
VIN- The type of the async function input-parameter, which implementsCloseable.VOUT- The type of the async function result, orVoidif the async function does not return anything (i.e. it only has side-effects).E- The type of the exception thrown by the async function, orNeverThrowsExceptionif no exception is thrown by the function.
- All Implemented Interfaces:
AsyncFunction<VIN,VOUT,E>
public final class CloseSilentlyAsyncFunction<VIN extends Closeable,VOUT,E extends Exception> extends Object implements AsyncFunction<VIN,VOUT,E>
AsyncFunctionthat silently closes an input-parameter after a delegate-function'sAsyncFunction.apply(Object)is completed.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Promise<VOUT,E>apply(VIN value)Invokes the delegate async function'sAsyncFunction.apply(Object)with the input parametervalue, closes it when the delegated promise completes.static <IN extends Closeable,OUT,EX extends Exception>
AsyncFunction<IN,OUT,EX>closeSilently(AsyncFunction<IN,OUT,EX> delegate)Wraps a delegate asynchronous function in aCloseSilentlyAsyncFunction.
-
-
-
Method Detail
-
closeSilently
public static <IN extends Closeable,OUT,EX extends Exception> AsyncFunction<IN,OUT,EX> closeSilently(AsyncFunction<IN,OUT,EX> delegate)
Wraps a delegate asynchronous function in aCloseSilentlyAsyncFunction.- Type Parameters:
IN- The type of the asynchronous function input-parameter, which implementsCloseable.OUT- The type of the function result, orVoidif the async function does not return anything (i.e. it only has side-effects).EX- The type of the exception thrown by the async function, orNeverThrowsExceptionif no exception is thrown by the function.- Parameters:
delegate- Delegate asynchronous function.- Returns:
- New
CloseSilentlyAsyncFunctioninstance.
-
-