|
|
|
@ -216,8 +216,6 @@ public final class PoolUtilities
|
|
|
|
|
public static boolean isJdbc40Compliant(final Connection connection) throws SQLException
|
|
|
|
|
{
|
|
|
|
|
if (!jdbc40checked) {
|
|
|
|
|
jdbc40checked = true;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
connection.isValid(5); // This will throw AbstractMethodError or SQLException in the case of a non-JDBC 41 compliant driver
|
|
|
|
|
IS_JDBC40 = true;
|
|
|
|
@ -225,6 +223,9 @@ public final class PoolUtilities
|
|
|
|
|
catch (NoSuchMethodError | AbstractMethodError | SQLFeatureNotSupportedException e) {
|
|
|
|
|
IS_JDBC40 = false;
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
jdbc40checked = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return IS_JDBC40;
|
|
|
|
@ -263,8 +264,6 @@ public final class PoolUtilities
|
|
|
|
|
public static int setNetworkTimeout(final Executor executor, final Connection connection, final long timeoutMs, final boolean isUseNetworkTimeout) throws SQLException
|
|
|
|
|
{
|
|
|
|
|
if ((IS_JDBC41 || !jdbc41checked) && isUseNetworkTimeout) {
|
|
|
|
|
jdbc41checked = true;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
final int networkTimeout = connection.getNetworkTimeout();
|
|
|
|
|
connection.setNetworkTimeout(executor, (int) timeoutMs);
|
|
|
|
@ -274,6 +273,9 @@ public final class PoolUtilities
|
|
|
|
|
catch (SQLFeatureNotSupportedException | AbstractMethodError | NoSuchMethodError e) {
|
|
|
|
|
IS_JDBC41 = false;
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
jdbc41checked = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|