• Post Reply Bookmark Topic Watch Topic
  • New Topic

SingleThreadModel interpretation

 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
Given>
Is "count" thread safe ?
class MyServelet extends HttpServlet implements SingleThreadModel{
private static int count;

}

Given this is the only information:

Is it mandatory to consider servlet pool for MyServlet ?

because if we assume that pool will be there... then "count" not thread safe.
and if we think pool is not there then count is thread safe.

Any Suggestions on how we have to interpret the above question.
 
Justin Chu
Ranch Hand
Posts: 209
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way SingleThreadModel is implemented is up to the web container implementation. So, you should assume it is not thread safe.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this just an academic question? Or are you actually using it? SingleThreadModel is deprecated and should not be used.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!