Hi,

When the Ignite node.stop() is called (e.g. the default segmentation strategy), 
or when the "main" thread exists, we would like to have the JVM automatically 
exit as well.


We have threads from Ignite, from RxJava, Vert.x, Netty, and a "main" thread, 
for boot.


We understand why the JVM does not exit when the "main" thread exits or when 
the Ignite threads exit (due to a stop initiated on node-partitioned/segmented 
for instance). Simply there are lots of non-daemon threads, and for a reason: 
protecting any I/O they would be doing.


However this makes it that we can find running JVMs which are no longer 
connected in the grid (and which do not retry to connect due to say a 
segmentation and a stop, the default strategy). Or ones which did not correctly 
initialize but remain running as processes.


Do you have any advice on how to be able to have the JVM automatically exit 
when Ignite gives up on being part of the cluster, for instance?


One way to do it is mark all the threads with daemon, except one - we can have 
the main thread forever blocking after booting the application. This is risky - 
we can loose/corrupt data if threads are doing I/O when the JVM abruptly shuts 
down. Still, being a resilient system which anyway needs to deal with such 
anomalies, that may still be a possible solution, albeit an ugly one.


Another one, which would treat strictly the segmentation scenario is to 
register a handler to the Ignite events that treats segmentation-event by doing 
a System.exit.


However, I think we need a general solution to stop the JVM when going out of 
memory, or any other Error, or out of grid/network, or when the main thread 
throws an exception while booting (of course the main thread would not exit 
after a successful boot, we would do like an infinite sleep there or wait for 
lock we never unlock).


Which way do you suggest?



Met vriendelijke groeten/Meilleures salutations/Best regards

Nicolae Marasoiu
Agile Developer
E nicolae.maras...@cegeka.com<mailto:nicolae.maras...@cegeka.com>

[http://signature.cegeka.com/mailsignature_cgk.png]
CEGEKA * 15-17 Ion Mihalache Blvd. Tower Center Building, 4th,5th,6th fl * 
RO-011171 Bucharest (RO) * T +40 21 336 20 65 * www.cegeka.com
Volg Cegeka: [http://signature.cegeka.com/twitter.png] 
<http://www.twitter.com/cegeka>  [http://signature.cegeka.com/linkedin.png] 
<http://www.linkedin.com/company/cegeka>  
[http://signature.cegeka.com/facebook.png] <http://www.facebook.com/Cegeka>  
[http://signature.cegeka.com/google-plus.png] <http://www.cegeka.be/googleplus>

Reply via email to