Exception Models in Java
In java, there are two exception models. Java programming language has two models of exception handling. The exception models that java suports are as follows.
- Termination Model
- Resumptive Model
Let's look into details of each exception model.
In the termination model, when a method encounters an exception, further processing in that method is terminated and control is transferred to the nearest catch block that can handle the type of exception encountered.
In other words we can say that in termination model the error is so critical there is no way to get back to where the exception occurred.
The alternative of termination model is resumptive model. In resumptive model, the exception handler is expected to do something to stable the situation, and then the faulting method is retried. In resumptive model we hope to continue the execution after the exception is handled.
In resumptive model we may use a method call that want resumption like behavior. We may also place the try block in a while loop that keeps re-entering the try block util the result is satisfactory.