• Post Reply Bookmark Topic Watch Topic
  • New Topic

can finally block won't execute  RSS feed

 
Raghusham Sankargal
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Is there any circumstances where the finally block won't be executed. If yes then which situations are those. By the way thanks in advance.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

First, a bit of business: you may not have read our naming policy on the way in. It requires that you use a full, real (sounding) first and last name for your display name. A single name isn't enough. You can change your display name
here.
Please do so immediately.

This finally block won't be executed:



You can come up with related scenarios using native methods.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're looking at this for practical reasons, you may want to check out java.lang.Runtime's addShutdownHook method, but its behavior is different than a finally block. Of course, shut down hooks can also be circumvented, by native code or Runtime's halt method, for example.
 
Paul Clapham
Sheriff
Posts: 22844
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's another case where the finally block isn't executed:
 
Raghusham Sankargal
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ernest,
Thanks for the information. I changed it yesterday. I thought my name is too long. I just want to have the ragsh as my business name. It is indeed derived from my name
rag: raghu(first name)
sh: sham(last name)
But it was combined. I think that was the mistake.

Any way I changed it as you said. Thanks once again. I am not interested to break the policies of a site or a forum that gives so much of knowledge.
 
Jaime M. Tovar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With a VM crash, as when having out of memory exception.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!