Sun River
Topics about Java SE, Servlet/JSP, JDBC, MultiThread, UML, Design Pattern, CSS, JavaScript, Maven, JBoss, Tomcat, ...
posts - 78,comments - 0,trackbacks - 0
Identify which attribute scopes are thread-safe:
  1. Local variables Yes, thread-safe
  2. Instance variables
  3. Not thread-safe
    Since a single servlet instance may be handling multiple service requests at any given time.
  4. Class variables
  5. Not thread-safe
    Since multiple servlets and /or service requests may try to access a class variable concurrently.
  6. Request attributes
  7. Yes, thread-safe
    Since the request object is a local variable
  8. Session attributes
  9. Not thread-safe
    Since sessions are scoped at the web application level, hence the same session object can be accessed concurrently by multiple servlets and their service requests
  10. Context attributes
  11. Not thread-safe
    Since the same context object can be accessed concurrently by multiple servlets and their service requests
posted on 2006-10-08 12:41 Sun River 阅读(240) 评论(0)  编辑  收藏 所属分类: Servlet & Jsp