• Post Reply Bookmark Topic Watch Topic
  • New Topic

Questioin Thread safe servlet  RSS feed

 
Narsimha Reddy Mandadi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have one question Thread safe.

If a instance variable is delcared as final varibale in defalut threading environment(simply extends HttpServlet).
Does it thread safe as it can't be modified?

Update me with your solution.

Thanks in advance.

Regards,
Narsimha Reddy M.
 
Ed Lance
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, since the value of a final variable can't be changed once set it's essentially a read only variable.

The other thing to consider here is when will the variable be initialized, if it's essentially "hard coded" or set during init, everything should would smoothly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!