multithreading - Java daemon - handling shutdown requests -


I am currently working on a daemon that is doing a lot of different things. It is multi-threaded and is being designed to control any kind of internal error without crashing. Well I'm going to handle a shutdown request and I'm not sure how I should go about doing this.

I have a closed hook setup, and when it is called it says a variable is the main daemon loop problem to prevent the running, this daemon produces several threads and they have a long Can take time. For example, one of these formulas can change the document. Most of them will be quick (I'm guessing less than 10 seconds), but there will be threads that can stay for 10+ minutes.

What I'm just thinking of doing when a shutdown hook has been sent, Threadgroup. Make a loop for 5 seconds with active sleepout (or so) for 5 seconds (all these threads are in the thread group) and before this loop, I will tell all the threads that they have been called a shutdown request. Then they do not matter immediately that they are cleaning and closing.

Anyone else have any suggestions? I am interested in the fact that when a daemon such as MySQL stops for example, it immediately closes. What happens if 10 are running like questions which are very slow? Does this wait or does it just end them? I mean that the server is really quick, so there really is no such operation, which I can not do in less than a second. You can now do a lot in 1000ms.

Thanks

Number of utilities, such as ( executable Various special types of executable apply to the class] and Threadpool Accelerator.WitTermination () , which you might want to see - as they provide the same exact functionality Instead of worrying about things like threads and task scheduling, which you want to implement, instead of worrying about your apps / Can focus on implementing the actual performance of tasks.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -