Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6800195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:56:24+00:00 2026-05-26T18:56:24+00:00

we have been using ThreadLocal so far to carry some data so as to

  • 0

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 dont 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 doesnt want to add this to the API). I wondering if this approach is good. What r the pros and cons.

ok here is a simple scenario

  1. user logs in and submits a request
  2. system establishes context for this entire request which include
    – unique id for this request
    – username
    – system looged in (user can log into multiple systems)
    – some DOMAIN EVENTS for later use
  3. the request passes through multiple logical layers (presentation, business domain,
    rules, integration) etc
  4. in the integration layer, we borrow few threads from pool to parallel pull data from
    multiple partners. each of the pulls need some data stored earlier in thread local, so we migrate those to the pooled threads
  5. after all data is received from partners, we migrate back the new thread local data accumulated in the child threads to the main thread
  6. at the end of the interaction we persist the DOMAIN events to DB
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:56:25+00:00Added an answer on May 26, 2026 at 6:56 pm

    you may want to introduce a request context: http://www.corej2eepatterns.com/Patterns2ndEd/ContextObject.htm

    you can handle creation/destruction of such an object in a Filter if you’re using a WebContainer or an Interceptor if you’re using an ApplicationServer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using git for some time now, and i like it, however,
We have been using Perl's Net:Twitter CPAN module (version 3.12) and basic authentication (not
We have been using EHCache with CF8 for a while now with no issues.
I have been using VS2010 without any issues, always on the same application. Suddenly
I have been using Snipshot's API to provide simple image editing inside a web
I have been using advance on some iterators , but I am afraid of
I have been using data binding for several years with win forms, but now
I have been using Flask for some time now and I am really enjoying
We have been using CruiseControl for quite a while with NUnit and NAnt. For
I have been using PHP and JavaScript for building my dad's website. He wants

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.