Created
June 23, 2014 20:55
-
-
Save joshuakfarrar/100c28240daf014094c8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@Override | |
public UserRefreshResult call() throws InterruptedException { | |
try { | |
checkCacheForUser(); | |
} catch (UserNotCachedException e) { | |
tryCachingUser(); | |
} catch (ApiRequestForUserAlreadyStartedException e) { | |
logger.warn("There is already a registration in progress, ignoring"); | |
return UserRefreshResult.IN_PROGRESS; | |
} | |
... | |
} | |
private void checkCacheForUser() { | |
if (isUserCached()) { | |
return; | |
} else if (isRegistrationAlreadyStarted()) { | |
throw new ApiRequestForUserAlreadyStartedException(); | |
} else { | |
throw new UserNotCachedException(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment