troubleshooting Question

MultiThreaded servlet issues

Avatar of RockyFullen
RockyFullen asked on
JavaJava EE
11 Comments1 Solution206 ViewsLast Modified:
  I am writing a program using servlets, however do not completely understand the
issues which I may run into concerning multi thread. So, a couple of question:


public class DDPanes extends HttpServlet
int classvarA;
int classvarB;



Given the following:
First user -
1st call to doget - sets classvarA = 1; sets classvarB = 2;
2nd call to doget - sets nothing; prints classvarA, classvarB
* will classvarA, classvarB still be equal to the values set in the first call?

* If a second user accesses this servlet GUI from another PC while the first user is pe rforming 1st test.
Are the class variables shared between sessions, so that the second user will see the values set
by the first user.....or are the class variables different instance by session?

* What if I implement single threaded model?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 11 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros