• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Basic question

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic