This is a simple helper library to retry any function. This library compiles only on Java 8.
int MAX_RETRY = 3;
RetryUtil.<Boolean>retry(MAX_RETRY,
() -> {
//Function to retry
return true;
});