File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Context Parameters - Thread safe?

 
Rashmi Gupta
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response Michael. I got the difference.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic