> 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
[ _ ] 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.