tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David kerber <dcker...@verizon.net>
Subject Re: Context destroy sequence of events
Date Fri, 11 Dec 2015 16:41:20 GMT
On 12/11/2015 8:30 AM, David kerber wrote:
> Running TC 8.0.22 with JRE 1.8.0.60 on Windows 2008 R2, as a windows
> service.
>
> Can someone point me to a reference that will tell me exactly what the
> sequence of events is when a servlet that is running as a windows
> service, is shut down?
>
> My situation is that my application receives data in a continuous stream
> and caches them for a period of time.  Then based on a couple of
> different triggers, it will write them to disk.
>
> What I need is a way to allow the windows service to be stopped in such
> a way that the servlet will not accept any more data while I flush my
> caches to disk.  This ensures that I don't lose any data during the
> shutdown (the remote clients that are sending the data will not move on
> to the next piece of data until they get the correct response from the
> server for the previous one).
>
> If I can ensure that (for example) the servlet will not accept any more
> connections when contextDestroyed event is triggered, but I will still
> be able to call my cache flushing routines, I think that would do what I
> need.
>
> Or if I can use the contextDestroyed event to set a flag in my
> servlet.doPost method to tell it to stop processing, that would work
> too.  Then I can call my cache flushing after that.
>
> Suggestions?

Is Servlet.destroy() the place for this kind of cleanup?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message