...
This compliant solution uses a custom ThreadPoolExecutor that extends ThreadPoolExecutor and overrides the beforeExecute() method. This method is invoked before the Runnable is executed in the specified thread. It is used to re-initialize reinitialize the thread local variable before task r is executed by thread t.
...