HHH-9174 Increase performance
of SqlExceptionHelper#handleAndClearWarnings
This commit is contained in:
parent
5d8a45ca0c
commit
92bf2b7d57
|
@ -284,12 +284,17 @@ public class SqlExceptionHelper {
|
|||
@SuppressWarnings( {"ThrowableResultOfMethodCallIgnored"} )
|
||||
public void handleAndClearWarnings( Statement statement,
|
||||
WarningHandler handler ) {
|
||||
try {
|
||||
walkWarnings(statement.getWarnings(), handler);
|
||||
} catch (SQLException sqlException) {
|
||||
// workaround for WebLogic
|
||||
LOG.debug("could not log warnings", sqlException);
|
||||
}
|
||||
// See HHH-9174. Statement#getWarnings can be an expensive call for many JDBC libs. Don't do it unless
|
||||
// the log level would actually allow a warning to be logged.
|
||||
if (LOG.isEnabled(Level.WARN)) {
|
||||
try {
|
||||
walkWarnings(statement.getWarnings(), handler);
|
||||
} catch (SQLException sqlException) {
|
||||
// workaround for WebLogic
|
||||
LOG.debug("could not log warnings", sqlException);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// Sybase fail if we don't do that, sigh...
|
||||
statement.clearWarnings();
|
||||
|
|
Loading…
Reference in New Issue