Create a gist now

Instantly share code, notes, and snippets.

@jdamcd /PollingState.java Secret
Last active Sep 19, 2015

What would you like to do?
private static final PollingState {
private static final int MAX_RETRIES = 2;
private boolean resultObtained = false;
private int requestCount = 0;
public Func0<Boolean> shouldContinue() {
return () -> requestCount <= MAX_RETRIES && !resultObtained;
}
public resultObtained() {
resultObtained = true;
}
public void increment() {
requestCount++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment