-
-
Save jdamcd/5f1ed1c9acadf9b255f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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