Following up on How to use MDC with thread pools? how can one use MDC with a ForkJoinPool
? Specifically, I how can one wrap a ForkJoinTask
so MDC v
I am unfamiliar with ForkJoinPool
but you can pass the MDC key/values of interest to the ForkJoinTask
instances that you instantiate before submitting them to the ForkJoinPool
.
Given that as of logback version 1.1.5, MDC values are not inherited by child threads, there are not too many options. They are
ForkJoinTask
instances as you instantiate themForkJoinPool
so that MDC key/values are passed to the newly created threadsPlease note that I have not actually implemented either options 2. or 3.