EXCEPTIONS
Handling Asynchronous Exceptions
11.3.2
encountered that can handle the exception; execution then continues by executing
the block of that
catch
 clause. The code that caused the exception is never
resumed.
If no
catch
 clause handling an exception can be found, then the current
thread (the thread that encountered the exception) is terminated, but only after all
finally
 clauses have been executed and the method
uncaughtException
( 20.21.31) has been invoked for the
ThreadGroup
 that is the parent of the cur 
rent thread.
In situations where it is desirable to ensure that one block of code is always
executed after another, even if that other block of code completes abruptly, a
try
statement with a
finally
 clause ( 14.18.2) may be used. If a
try
 or
catch
 block
in a
try
finally
 or
try
catch
finally
 statement completes abruptly, then the
finally
 clause is executed during propagation of the exception, even if no
matching
catch
 clause is ultimately found. If a
finally
 clause is executed
because of abrupt completion of a
try
 block and the
finally
 clause itself com 
pletes abruptly, then the reason for the abrupt completion of the
try
 block is dis 
carded and the new reason for abrupt completion is propagated from there.
The exact rules for abrupt completion and for the catching of exceptions are
specified in detail with the specification of each statement in  14 and for expres 
sions in  15 (especially  15.5).
11.3.1   Exceptions are Precise
Exceptions in Java are
precise
: when the transfer of control takes place, all effects
of the statements executed and expressions evaluated before the point from which
the exception is thrown must appear to have taken place. No expressions, state 
ments, or parts thereof that occur after the point from which the exception is
thrown may appear to have been evaluated. If optimized code has speculatively
executed some of the expressions or statements which follow the point at which
the exception occurs, such code must be prepared to hide this speculative execu 
tion from the user visible state of the Java program.
11.3.2   Handling Asynchronous Exceptions
Most exceptions in Java occur synchronously as a result of an action by the thread
in which they occur, and at a point in the Java program that is specified to possibly
result in such an exception. An asynchronous exception is, by contrast, an excep 
tion that can potentially occur at any point in the execution of a Java program.
Proper understanding of the semantics of asynchronous exceptions is neces 
sary if high quality machine code is to be generated.
205






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved