Skip to content

Instantly share code, notes, and snippets.

@jdamcd
Last active September 19, 2015 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdamcd/5f1ed1c9acadf9b255f0 to your computer and use it in GitHub Desktop.
Save jdamcd/5f1ed1c9acadf9b255f0 to your computer and use it in GitHub Desktop.
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