Skip to content

Instantly share code, notes, and snippets.

View allenktv's full-sized avatar

Allen Vicencio allenktv

  • Google
  • United States
View GitHub Profile
@allenktv
allenktv / gist:e3ab30f83995f9eaf6b0
Last active September 21, 2015 22:46
Allows retry of a function, and retries it if null is returned
public class RetryRunner<T> {
public T runWithRetries(IRetry<T> retry, int numOfRetries) {
for (int i = 0; i <= numOfRetries; i++) {
T value = retry.run();
if (value != null) {
return value;
}
}
return null;
}