org.firebirdsql.jaybird.xca

## Class FatalErrorHelper

- java.lang.Object
- - org.firebirdsql.jaybird.xca.FatalErrorHelper

-     public final class FatalErrorHelper
      extends java.lang.Object

  Helper class for the exception handling in XCA framework. The JCA specification required a resource adapter to report an error if it is certain that no other operations can be executed over that particular managed connection.

  In case of Firebird, few errors belong to the so-called "fatal errors", after which client application cannot continue its job. For example, when a socket connection to the server is broken, any subsequent operation will fail. The XCA container should remove the connection from the pool in order to allow process to recover (when Firebird server is restarted).

  NOTE: Although these methods are intended for use within XCA, they can be used for other parts of Jaybird which have similar needs for connection error evaluation.

  Author:
    Roman Rokytskyy, Mark Rotteveel

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `isBrokenConnection(java.lang.Exception exception)` Checks whether `exception` indicates a broken connection.
    `static boolean` | `isFatal(java.sql.SQLException exception)` Check whether the specified exception is fatal from the XCA point of view.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### isFatal

          public static boolean isFatal(java.sql.SQLException exception)

      Check whether the specified exception is fatal from the XCA point of view.
      Parameters:
        `exception` - exception to check.
      Returns:
        `true` if the exception that happened is fatal

    - #### isBrokenConnection

          public static boolean isBrokenConnection(java.lang.Exception exception)

      Checks whether `exception` indicates a broken connection. There is overlap with `isFatal(SQLException)`, but neither is a subset of the other.

      Specifically, this method will check if the first `SQLException` in the cause-chain of `exception` (including `exception` itself) has a "broken connection error code" (a proper subset of "fatal error codes"), or otherwise of there is a `SocketTimeoutException` or `SocketException` in the cause-chain.

      NOTE: Exact checks done by this method may be revised in any point release, and above documentation should be considered illustrative, and not prescriptive.

      Parameters:
        `exception` - exception to check
      Returns:
        `true` if the error code is signals a (possibly) broken connection

Copyright © 2001-2025 Jaybird (Firebird JDBC) team. All rights reserved.