Skip to main content
11 events
when toggle format what by license comment
Jul 31, 2013 at 21:49 comment added Dhrubajyoti Gogoi Just to add, if the main thread exits, finally block of daemon threads are also not executed.
Jul 31, 2013 at 20:48 comment added Saj @Thecoolguyacrossthestreet You got it!
Jul 31, 2013 at 20:47 comment added Comic Sans MS Lover @SajalDutta I see... thanks. In this case I'll the first example. I'll be sure to remember not to return anything at the finally block.
Jul 31, 2013 at 20:46 vote accept Comic Sans MS Lover
Jul 31, 2013 at 20:43 comment added Saj @Thecoolguyacrossthestreet It would be a bad practice, if you had a return statement also in finally block because your catch block's return statement would be useless in that case.
Jul 31, 2013 at 20:34 comment added Peter Lawrey @Thecoolguyacrossthestreet I would say the first is the simplest and what I would do.
Jul 31, 2013 at 20:25 comment added JB Nizet @Thecoolguyacrossthestreet: No, it's not. It's completely fine.
Jul 31, 2013 at 20:24 comment added Marko Topolnik The interesting bit, overlooked by many, is that Thread#stop will not prevent the finally from executing.
Jul 31, 2013 at 20:24 comment added Comic Sans MS Lover But is my first example a bad practice?
Jul 31, 2013 at 20:23 comment added ppeterka ... and a power outage :) (blast, you ruined it with adding the JVM crash)
Jul 31, 2013 at 20:22 history answered JB Nizet CC BY-SA 3.0