Dropwizard Async Non-Blocking
![Maven Central](https://camo.githubusercontent.com/ed71896d692dda44cc381c6f3a44dfdbaab6781a1df76fb07da0b9a7cf69342c/68747470733a2f2f6d6176656e2d6261646765732e6865726f6b756170702e636f6d2f6d6176656e2d63656e7472616c2f7a6f6e652e647261676f6e2e64726f7077697a6172642f64726f7077697a6172642d6173796e632f62616467652e737667)
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.