Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Basic question

 
Mathur Neni
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess this may be a basic question.

We have a Action class, which has a protected inner class, which contain some attributes. When multiple users are accessing, app is giving wrong info back (some others user data). Basically the same kind of problem happened in servlet and that was cleared by bringing attributes into the doGet method.

Is there any reason that the attributes in the inner class are being shared when multiple users access. And thus can cause any switched data being displayed to users.

Any suggestions are helpful.

Thanks in advance.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The important thing to remember is that an Action class, like a servlet will be used by multiple threads, and must be written as thread safe. Without looking at your Action class, it's not possible to comment on why your inner class isn't thread safe, but it apparently isn't. An inner class isn't inherently non-thread-safe, but it is certainly possible to access an inner class in a non-thread-safe way.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic