You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/06/11 14:15:26 UTC

[GitHub] [shardingsphere] kimmking commented on a change in pull request #6002: AbstractConnectionAdapter implement Connection#isValid(int) method

kimmking commented on a change in pull request #6002:
URL: https://github.com/apache/shardingsphere/pull/6002#discussion_r438819100



##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractConnectionAdapter.java
##########
@@ -239,6 +239,16 @@ public final void setTransactionIsolation(final int level) throws SQLException {
         recordMethodInvocation(Connection.class, "setTransactionIsolation", new Class[]{int.class}, new Object[]{level});
         forceExecuteTemplate.execute(cachedConnections.values(), connection -> connection.setTransactionIsolation(level));
     }
+
+    @Override
+    public final boolean isValid(final int timeout) throws SQLException {
+        for (Connection connection : cachedConnections.values()) {
+            if (!connection.isValid(timeout)) {
+                return false;

Review comment:
       is there some cases need return true, such as m-s?

##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/main/java/org/apache/shardingsphere/driver/orchestration/internal/circuit/connection/CircuitBreakerConnection.java
##########
@@ -127,7 +128,12 @@ public PreparedStatement prepareStatement(final String sql, final int[] columnIn
     public PreparedStatement prepareStatement(final String sql, final String[] columnNames) {
         return new CircuitBreakerPreparedStatement();
     }
-    
+
+    @Override
+    public boolean isValid(final int timeout) throws SQLException {
+        return true;

Review comment:
       why true?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org