The finally Block Always Executes

We recently received some very good feedback from a reader, Russel Taylor, regarding The finally Block page.

Russel pointed out that, though it might be obvious, the finally block will not be executed if the JVM exits while in the process of executing the try or catch code. Likewise (and this is where it might be less obvious), if the code is executing on another thread and that thread is interrupted or killed, the finally block would not be executed, even if the application continues.

This exact problem led to a production outage that Russel helped to debug.

I have modified this page of the tutorial to include a note about this fact. Thanks, Russel, for helping us to improve the tutorial!

-- Sharon Zakhour

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Blog about Java technology documentation and news about Java releases.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today