This is not possible as the destroy() can only invoked by the container, Which always makes sure there is no client is being processed before executing destroy().
Above answer was rated as good by the following members: phdsong
November 27, 2005 02:07:37
ravi
RE: Consider a scenario in which 4 users are accessing...
Hi
We know that by default servlet is multithreaded for every client request a new thread will be created and assigned to that to perform the service. so if one thread initiates destroy() only itself will be terminated but other threads not terminates.
Other wise it is against to servlet spec. regarding multithreading concept. ex: suppose if u open 2 browser instances for a website if u move from one site to another in one browser the other remains connect to same site not terminates.
RE: Consider a scenario in which 4 users are accessing...
This is not possible as the destroy() can only invoked by the container Which always makes sure there is no client is being processed before executing destroy().
RE: Consider a scenario in which 4 users are accessing a servlet instance. Among which one user called destroy() method. What happens to the rest 3 users?
if there are 4 user and one has distroy the thred then thread which he is using only that will be distroy rest will be keep alive