This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Basic question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Basic question" Watch "Basic question" New topic
Author

Basic question

Mathur Neni
Ranch Hand

Joined: May 10, 2004
Posts: 33
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

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Basic question
 
Similar Threads
Jboss 4.2GA distributed environment
Inner class/anonymous
Servlets basic question