aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Context Parameters - Thread safe? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Context Parameters - Thread safe?" Watch "Context Parameters - Thread safe?" New topic
Author

Context Parameters - Thread safe?

Rashmi Gupta
Greenhorn

Joined: Jul 27, 2007
Posts: 2
Hi,

The question below is from Java Beat Mock Exam.

26.Which of the following are true regarding the parameters defined using the <context-param> element of a deployment descriptor?

Select 2 correct options.
A.They are thread safe.
B.They are accessible from multiple threads simultaneously and from any servlet of the web application.
C.They can be modified using the setAttribute() method.
D.They can be modified using the setParameter() method.
E.They can be modified using the setInitParameter() method.

ANS : A,B

I think option A is incorrect, as the context parameters are never thread safe.
Any thoughts on this problem would be appreciated.

Thanks
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
Context parameters are read only and therefore are thread safe. These parameters (as well as Servlet init parameters) are set in the web.xml.

Context attributes, on the other hand are not thread safe.

I think you are confusing parameters and attributes.
Rashmi Gupta
Greenhorn

Joined: Jul 27, 2007
Posts: 2
Thanks for the response Michael. I got the difference.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Context Parameters - Thread safe?