What are the pros and cons of using an in memory DB rather than a ThreadLocal

Posted by Pangea on Stack Overflow See other posts from Stack Overflow or by Pangea
Published on 2010-03-24T02:18:33Z Indexed on 2010/03/24 3:03 UTC
Read the original article Hit count: 317

Filed under:
|

We have been using ThreadLocal so far to carry some data so as to not clutter the API. However below are some of issues of using thread local that which I don't like:

1) Over the years the data items being carried in thread local has increased
2) Since we started using threads (for some light weight processing), we have also migrating these data to the threads in the pool and copying them back again

I am thinking of using an in memory DB for these (we doesn't want to add this to the API). I wondering if this approach is good. What are the pros and cons?

thx in advance.

© Stack Overflow or respective owner

Related posts about java

Related posts about best-practice