is there way listen when spark framework shutting down, run cleanup? example, want close out elasticsearch client.
one approach use runtime.getruntime().addshutdownhook()
.
this general java mechanism running code when program exits. since spark framework web application normal web application, work. see the java documentation.
however, hook not run if vm process aborted using sigkill signal on unix or terminateprocess call on microsoft windows. note applies pressing "stop" button in ides.
Comments
Post a Comment