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.
posted 10 years ago
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.