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
Modifier and TypeMethodDescriptionstatic boolean
isBrokenConnection
(Exception exception) Checks whetherexception
indicates a broken connection.static boolean
isFatal
(SQLException exception) Check whether the specified exception is fatal from the XCA point of view.
-
Method Details
-
isFatal
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
Checks whetherexception
indicates a broken connection. There is overlap withisFatal(SQLException)
, but neither is a subset of the other.Specifically, this method will check if the first
SQLException
in the cause-chain ofexception
(includingexception
itself) has a "broken connection error code" (a proper subset of "fatal error codes"), or otherwise of there is aSocketTimeoutException
orSocketException
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
-