I have been dealing with this question for quite some time. Can anybody help me with figuring out which of the following attribute scopes are thread safe in case the servlet implements the SingleThreadModel interface as well as in case it does not local variables instance variables class variables request attributes session attributes context attributes TIA - Chris
local variables - always thread safe instance variables/class variables - not thread safe request attributes - thread safe session attributes - not inheritly thread safe (multiple requests can belong to the same session) context attributes - never thread safe (the servlet context is shared across all instances of the servlet)
Christopher's list covers the case where SingleThreadModel is not implemented. When you implement SingleThreadModel in your servlet, the following change: instance variables - thread safe class variables - not thread safe Everything else stays the same. - Peter
Nothing up my sleeve ... and ... presto! A tiny ad:
Devious Experiments for a Truly Passive Greenhouse!