open fun setAwaitTerminationSeconds(awaitTerminationSeconds: Int): Unit
Set the maximum number of seconds that this ForkJoinPool is supposed to block on shutdown in order to wait for remaining tasks to complete their execution before the rest of the container continues to shut down. This is particularly useful if your remaining tasks are likely to need access to other resources that are also managed by the container.
By default, this ForkJoinPool won't wait for the termination of tasks at all. It will continue to fully execute all ongoing tasks as well as all remaining tasks in the queue, in parallel to the rest of the container shutting down. In contrast, if you specify an await-termination period using this property, this executor will wait for the given time (max) for the termination of tasks.
Note that this feature works for the "commonPool" mode as well. The underlying ForkJoinPool won't actually terminate in that case but will wait for all tasks to terminate.
See Also
java.util.concurrent.ForkJoinPool#shutdown()java.util.concurrent.ForkJoinPool#awaitTermination