javaproject-reactorreactor-netty

Proper way to close reactor netty HttpClient


Reactor netty HttpClient does not have a method to close or shutdown the handle. What is the correct way of releasing resources of HttpClient?

As per document When I create a HttpClient using HttpClient client = HttpClient.create(); this will internally create a default connection pool. How can I make sure that connection pool is released properly?


Solution

  • If the connection pool is not used by other HttpClients, you can dispose it with invoking client.configuration().connectionProvider().dispose()/disposeLater()