While configuring tomcat to use only 1 thread, when using completablefuture for async processing, it is using another thread how?

The supplyAsync method documentation says:

Returns a new CompletableFuture that is asynchronously completed by a task running in the ForkJoinPool.commonPool() with the value obtained by calling the given Supplier.

The common pool is created by the JVM, it is described in the ForkJoinPool API doc:

A static commonPool() is available and appropriate for most applications. The common pool is used by any ForkJoinTask that is not explicitly submitted to a specified pool. Using the common pool normally reduces resource usage (its threads are slowly reclaimed during periods of non-use, and reinstated upon subsequent use).

Since this pool isn’t created by Tomcat the max thread limit doesn’t apply.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top