Dropwizard Async Non-Blocking
This bundle adds support for resources methods to return CompletionStage
and ListenableFuture
types, which allow for fully non-blocking handling of requests.
To use this bundle, add it to your application in the initialize method:
@Override
public void initialize(Bootstrap<T> bootstrap) {
bootstrap.addBundle(new AsyncBundle());
}
After that, simply return a CompletableFuture
from your resource methods and they will no longer tie up jetty request threads while the request continues to process.