Package net.solarnetwork.node.dao.jdbc
Class AbstractSQLExceptionHandler
java.lang.Object
net.solarnetwork.node.dao.jdbc.AbstractSQLExceptionHandler
- All Implemented Interfaces:
net.solarnetwork.dao.jdbc.SQLExceptionHandler
- Direct Known Subclasses:
ResetSQLExceptionHandler,RestoreFromBackupSQLExceptionHandler,ShutdownSQLExceptionHandler
public abstract class AbstractSQLExceptionHandler
extends Object
implements net.solarnetwork.dao.jdbc.SQLExceptionHandler
Base
SQLExceptionHandler with SQL state filtering support.- Since:
- 2.5
- Version:
- 1.0
- Author:
- matt
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SQLExceptionSee if the root SQL exception's state value matches any configured SQL State pattern.Get the list of regular expressions that should trigger an action by this handler.voidsetSqlStatePatterns(List<Pattern> sqlStatePatterns) Set a list of regular expressions that should trigger an action by this handler.voidsetSqlStateRegex(String regexes) Set a comma-delimited list of regular expressions that should trigger an action by this handler.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.solarnetwork.dao.jdbc.SQLExceptionHandler
handleConnectionException, handleConnectionException, handleGetConnectionException, handleGetConnectionException
-
Field Details
-
log
protected final org.slf4j.Logger logA class-level logger.
-
-
Constructor Details
-
AbstractSQLExceptionHandler
public AbstractSQLExceptionHandler()
-
-
Method Details
-
exceptionMatchingSqlStatePattern
See if the root SQL exception's state value matches any configured SQL State pattern.This will search the
getSqlStatePatterns()list and return the first one that matches the exception'sSQLException.getSQLState()value of the root SQL exception.- Parameters:
e- the exception to compare- Returns:
- the root exception that matched a pattern, or null if none match or no patterns are configured
-
getSqlStatePatterns
Get the list of regular expressions that should trigger an action by this handler.- Returns:
- the list of regular expressions
-
setSqlStatePatterns
Set a list of regular expressions that should trigger an action by this handler.- Parameters:
sqlStatePatterns- the regular expressions that should trigger an action
-
setSqlStateRegex
Set a comma-delimited list of regular expressions that should trigger an action by this handler.- Parameters:
regexes- a comma-delimited list of regular expressions that should trigger an action- See Also:
-