Keep runnable state in Threadpool

Viewed 35

There is any way to create a runnable task, that keep state, and can be used for several threads as ThreadLocal in a Threadpool.

I have the case where I have a DocumentBuilder that is not Thread-safe, and I would like to reuse for at least 10 threads, and .reset every time I finish in each of them, so I will end up creating only 10 instances of DocumentBuilder

Right now with JAXB I'm creating a new one per request, and the memory footprint it getting quite big under a lot of request.

0 Answers
Related