diff --git a/src/main/core-api/java/com/mysql/cj/util/Util.java b/src/main/core-api/java/com/mysql/cj/util/Util.java index acdd86085..e7a91082a 100644 --- a/src/main/core-api/java/com/mysql/cj/util/Util.java +++ b/src/main/core-api/java/com/mysql/cj/util/Util.java @@ -307,8 +307,9 @@ public static List loadClasses(String extensionClassNames, String errorMe * @return boolean */ public static boolean isJdbcInterface(Class clazz) { - if (Util.isJdbcInterfaceCache.containsKey(clazz)) { - return (Util.isJdbcInterfaceCache.get(clazz)); + final Boolean isJdbcInterface = Util.isJdbcInterfaceCache.get(clazz); + if (isJdbcInterface != null) { + return isJdbcInterface; } if (clazz.isInterface()) { diff --git a/src/main/user-impl/java/com/mysql/cj/jdbc/ha/plugins/failover/FailoverConnectionPlugin.java b/src/main/user-impl/java/com/mysql/cj/jdbc/ha/plugins/failover/FailoverConnectionPlugin.java index ff06a8b70..5f58b98f7 100644 --- a/src/main/user-impl/java/com/mysql/cj/jdbc/ha/plugins/failover/FailoverConnectionPlugin.java +++ b/src/main/user-impl/java/com/mysql/cj/jdbc/ha/plugins/failover/FailoverConnectionPlugin.java @@ -67,10 +67,14 @@ import java.util.Map; import java.util.Objects; import java.util.Properties; +import java.util.Set; import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Supplier; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; /** * A {@link IConnectionPlugin} implementation that provides cluster-aware failover @@ -92,22 +96,26 @@ public class FailoverConnectionPlugin implements IConnectionPlugin { static final String METHOD_CLOSE = "close"; static final String METHOD_IS_CLOSED = "isClosed"; - private static final List METHODS_REQUIRE_UPDATED_TOPOLOGY = new ArrayList<>(Arrays.asList( - METHOD_COMMIT, - "connect", - "isValid", - "rollback", - "setAutoCommit", - "setReadOnly", - "execute", - "executeBatch", - "executeLargeBatch", - "executeLargeUpdate", - "executeQuery", - "executeUpdate", - "executeWithFlags", - "getParameterMetaData" - )); + private final static Set METHODS_REQUIRE_UPDATED_TOPOLOGY = ConcurrentHashMap.newKeySet(); + + static { + METHODS_REQUIRE_UPDATED_TOPOLOGY.addAll(Arrays.asList( + METHOD_COMMIT, + "connect", + "isValid", + "rollback", + "setAutoCommit", + "setReadOnly", + "execute", + "executeBatch", + "executeLargeBatch", + "executeLargeUpdate", + "executeQuery", + "executeUpdate", + "executeWithFlags", + "getParameterMetaData" + )); + } private static final String METHOD_GET_TRANSACTION_ISOLATION = "getTransactionIsolation";