[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 257
  • Last Modified:

what r thread safe variables in jsp

what r thread safe variables in jsp and why in  the below options?

1.request variables
2.session varaibles
3.local variables
4.request,session
5.request,session,local
6.session,local
0
chaitu chaitu
Asked:
chaitu chaitu
  • 3
1 Solution
 
TimYatesCommented:
You mean if you write a multi threaded servlet or something?

1) no
2) no
3) no
4) no
5) no
6) no

Not 100% sure what you mean though... ;-)
0
 
chaitu chaituAuthor Commented:
yes if i write multi threaded servlet which of the variabled are threadsafe?
0
 
TimYatesCommented:
Only the read-only parameters request.getParameter, etc will be thread safe... none of the others are...
0
 
thomas908Commented:
I think local variables (variables u declare within a smethod in a servlet ) will also be thread safe although instance variables aren't.
i'd be better to get it verified though.

0
 
TimYatesCommented:
> I think local variables (variables u declare within a smethod in a servlet ) will also be thread safe although instance variables aren't.

Yep, same as with regular java classes :-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now