SingleThread Model Servlet

why the session attributes and static variables can be accessed by multiple threads even we implement the single thread model interface to our servlet?
[158 byte] By [V_newa] at [2007-11-27 6:17:43]
# 1
Because the single thread model doesn't have anything to do with accessing static variables, it only affects instance variables.It's also deprecated, so do not use SingleThreadModel.
-Kayaman-a at 2007-7-12 17:30:58 > top of Java-index,Java Essentials,Java Programming...
# 2

> Because the single thread model doesn't have anything

> to do with accessing static variables, it only

> affects instance variables.

>

> It's also deprecated, so do not use SingleThreadModel.

Hi Kayaman,

Can you explain bit more regarding SingleThreadModel, why multiple threads can access static variable even we implement SingleThreadModel? Can suggest me the alternative?

Thanks

V_newa at 2007-7-12 17:30:58 > top of Java-index,Java Essentials,Java Programming...
# 3

[ _ ] You understand SingleThreadModel

[ _ ] You understand what static means

[ X ] You failed to read the API docs.

SingleThreadModel says: "ensures that only one thread will be calling the service method". In other words: one instance of a servlet will only serve one request at a time. Which does not mean that there might be 20 instances and thus 20 threads around, which would then all access static methods concurrently.

CeciNEstPasUnProgrammeura at 2007-7-12 17:30:58 > top of Java-index,Java Essentials,Java Programming...