Created
October 7, 2016 18:05
-
-
Save eisenjulian/b4553d1381c96b15457b2eb664bcc618 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 <T> Optional<T> redisApply(final BiFunction<Jedis, Boolean, T> callback) { | |
final List<T> result = new ArrayList<>(); | |
new RetryingHandler().tryClosure((redisServer, results, loggingActivated, isProductionEnvironment) -> { | |
try (final Jedis jedis = redisServer.getPool().getResource()) { | |
result.add(callback.apply(jedis, isProductionEnvironment)); | |
} | |
}, null); | |
return result.stream().findFirst(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment