Hello everybody,
From the JVM (Java 8) point of view, what is in your mind the resource-cleanest way to do an asynchronous HTTP request that doesn't need to treat a response?
What I actually do is:
- I use a cachedThreadPool that quietly lives in a singleton bean
- Every time I need to send a request, I create a new thread (with executor.submit), I create an HttpPost (from org.apache.http.client) and I execute the post on a ClosableHttpClient inside a try(...){}
- At the end in the same thread I do EntityUtils.consume on the eventual response
Is there any simpler and cleaner way to do it on Java 8?
Thanks in advance, kind regards