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

servlet's thread safe

 
David Qiu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i am doing a project which allows more than one person to access a servlet, which results in multiple servlet instances at the same time. and i think some objects may not be in a consistent way, they are servlet class variables, request attributes, session attributes and context attributes. is that right? do i need to synchronized these objects? thanks in advance
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can either synchronize any access to those variables, or implement the "SingleThreadModel" interface.
Bosun
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic