JeanLuc,
In order to visualize the shutdown process in the client i can either listen for log messages (kinda hackish) to determine that some component has shutdown, or mimic what you do in Nxt.shutdown (call XXX.shutdown myself) but that might lead to undesired effects once the vm shutdownHandler kicks in. Or ... maybe you could add some more events, i think the most time consuming actions are Peers.shutdown and Db.shutdown.
Ideal would be if clients could determine how long the task is and be notified of the amount of work done, the shutdown progress could then be shown in a deterministic progressbar.
Looking at Db.shutdown this would require a listener registered with H2 (with which i'm not familiar) to listen to the COMPACT progress, so not sure if that could be done (for the future if the blockchain grows, i believe you do want to show detailed shutdown progress).
The Peers.shutdown and ThreadPool.shutdown would however be perfect for some kind of fine grained notification that tells you the number of threads that are awaiting shutdown and notifies you each time one has shutdown.
BTW. I can now perfectly display startup progress with the events you added!
-Edit- Looks like it might be possible
http://www.h2database.com/javadoc/org/h2/api/DatabaseEventListener.html it supports progress for scanning the database on startup for sure, but that is also handled by sending block added events.
I'd like to come back at this. The H2 listener is something a client developer can implement and register with H2. The shutdown of peer threads however could really use an event at START thread shutdown and at shutdown COMPLETE. Preferably send for each thread being shutdown.
I currently don't have the code from 0.8.0 fully integrated so i don't know if peer/thread shutdown does in fact take noticeable time. maybe i'm worrying about nothing.