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 8986083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:28:00+00:00 2026-06-15T21:28:00+00:00

I am confused about how should I handle http sessions in a standalone java

  • 0

I am confused about how should I handle http sessions in a standalone java app. Here are the details :

The java client connects to 3 tomcat 7 servlets.
When the client boots up, it starts 2 scheduled threads /downloader and uploader/ polling 2 of the servlets every 3mins. They both retrieve and store the jsessionid cookie in private fields in their respective classes.
This results in 2 sessions in tomcat reused for the lifetime of the webapp. So far so good.

There is a 3rd service /connected to the 3rd servlet/ using multiple instances of a threaded “WebDispather” class which retrieves and stores the session similarly to the above mentioned threads but this time – in a private static field.
The dispatcher is heavily used, there might be as many as 150 instances running concurrently depending on the load. Dispatcher threads hit the servlet ever second or so.

Making the dispatcher sessionid field non static creates a session per instance – not good.

What are the implications of having all dispatcher threads bound to the same tomcat http session?

Thank you


EDIT:
although dispather threads a bound to same session the session itself doesn’t hold any information.
Servlet processes only the request params.
I.e. dispatcher 1:

localhost/messagecontrol?id=123&state

Dispatcher thread 2:
localhost/messagecontrol?id=123&state=finished

//Servlet processes and forgets id and state

  • 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-06-15T21:28:02+00:00Added an answer on June 15, 2026 at 9:28 pm

    As far as I can see the implications are all client threads will share the same session information, if any information not meant to be shared this will be a bug on your code

    IF you’re worried about the number of threads created (performance-wise), consider implementing a thread pool in your code.

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

Sidebar

Related Questions

I'm writing a localized Android app; I'm confused about how to handle the differences
I am confused about which collection type that I should return from my public
I'm a little confused about the terminology I should use when referring to Linux
Should be a simple question for SDL experts. I am confused about the following
I am a little confused about the roles of a java application server and
I'm a bit confused about the size of my App! The folder and all
I'm a little confused about something. I wrote an app and tested it on
I'm a little confused about the HTTP protocol, from what i know HTTP was
I'm confused about when you should use event delegation as opposed to out-of-the-box JQuery
I'm a bit confused about the relationship a BLL and DAL has. Should the

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.