On May 31, 2012, at 1:05 PM, Jens Mueller <[email protected]> wrote:
> Walter Bright wrote: >> On 5/31/2012 12:40 AM, Jens Mueller wrote: >>> How do I do a graceful shutdown if finally and scope is not guaranteed >>> to be executed? Assuming onAssertError, etc. is of no use because I need >>> to perform different shutdowns due to having different cases or if I >>> defined my own Error, let's say for some device. >> >> There's no way to guarantee a graceful shutdown. >> >> No way. >> >> If you must have such, then the way to do it is to divide your >> application into separate processes that communicate via >> interprocess communication, then when one component fails the rest >> of your app can restart it or do what's necessary, as the rest is >> not in an invalid state. > > Okay, let's assume I have separate processes maybe even processes on > different machines. In one process I get an error. Let's say I want to > trigger the other process that it restarts the process or just logs the > event whatever makes sense. > How do I do this if it not guaranteed that finally/scope blocks are > being executed? > > I don't need a guarantee that the shutdown will work in each and every > case. All I need is the possibility to perform a more graceful shutdown. You pretty much need a local process monitor. This is needed anyway, since not every failure may throw. Say SIGBUS on Posix, for example.
