I am trying to use a class which implements singleton in my
servlet.
Here is what i was tring to do:
I call the above class from doGet like this:
and when I refresh it, I always get the same number.
If i understood correcty each request makes a new
thread to run, which calls service()->doPost/Get. There is always 1 instance of a servlet.
So if the above statemen is correct shouldn`t it always generate a new instance of Start class(in a new thread), so that i would benefit from singleton only if I would like to instantiate more then 1 Start class in the same thread/request. Does it have something to do with garbage collector?
Thanks in advance.