Package io.mosip.kernel.core.util
Class RetryUtil
- java.lang.Object
-
- io.mosip.kernel.core.util.RetryUtil
-
@Component public class RetryUtil extends Object
The RetryUtil - an Utility to invoke any method / expression with retries as per the configuration.
-
-
Constructor Summary
Constructors Constructor Description RetryUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T,E extends Throwable>
voiddoWithRetry(ConsumerWithThrowable<T,E> func, T t)Invoke the consumer with retry.<R,T,E extends Throwable>
RdoWithRetry(FunctionWithThrowable<R,T,E> func, T t)Invoke the function with retry.<E extends Throwable>
voiddoWithRetry(RunnableWithThrowable<E> func)Invoke the supplier with retry.<R,E extends Throwable>
RdoWithRetry(SupplierWithThrowable<R,E> func)Invoke the supplier with retry.
-
-
-
Method Detail
-
doWithRetry
public <R,T,E extends Throwable> R doWithRetry(FunctionWithThrowable<R,T,E> func, T t) throws E extends Throwable
Invoke the function with retry.- Type Parameters:
R- the generic typeT- the generic typeE- the element type- Parameters:
func- theFunctionWithThrowableinstance or its lambda expressiont- the t- Returns:
- the r
- Throws:
E- the eE extends Throwable
-
doWithRetry
public <R,E extends Throwable> R doWithRetry(SupplierWithThrowable<R,E> func) throws E extends Throwable
Invoke the supplier with retry.- Type Parameters:
R- the generic typeE- the element type- Parameters:
func- theSupplierWithThrowableinstance or its lambda expression- Returns:
- the r
- Throws:
E- the eE extends Throwable
-
doWithRetry
public <T,E extends Throwable> void doWithRetry(ConsumerWithThrowable<T,E> func, T t) throws E extends Throwable
Invoke the consumer with retry.- Type Parameters:
T- the generic typeE- the element type- Parameters:
func- theConsumerWithThrowableinstance or its lambda expressiont- the t- Throws:
E- the eE extends Throwable
-
doWithRetry
public <E extends Throwable> void doWithRetry(RunnableWithThrowable<E> func) throws E extends Throwable
Invoke the supplier with retry.- Type Parameters:
E- the element type- Parameters:
func- theRunnableWithThrowableinstance or its lambda expression- Throws:
E- the eE extends Throwable
-
-