Skip to content

Instantly share code, notes, and snippets.

@rowanl
Last active January 17, 2018 20:05
Show Gist options
  • Save rowanl/0e9c910cbf0a0f111291a27a52a68748 to your computer and use it in GitHub Desktop.
Save rowanl/0e9c910cbf0a0f111291a27a52a68748 to your computer and use it in GitHub Desktop.
playframework-kubernetes - Asynchronously find all models using Ebean in a non-blocking fashion
private <T> CompletionStage<T> wrapContext(Supplier<T> toRun) {
return supplyAsync(toRun, executionContext);
}
public CompletionStage<List<Charity>> findList() {
return wrapContext(() -> ebeanServer.find(Charity.class).findList());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment