From f8c6ad70b2fb8ad3b03c25c0621bbbac4b1fbdf5 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Fri, 27 Sep 2024 17:26:19 +0800 Subject: [PATCH] Revise #33024 (#33028) * Revise #33024 * Revise #33024 --- .../connection/ShardingSphereConnection.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/ShardingSphereConnection.java b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/ShardingSphereConnection.java index 4b963af32b73d..b492c6185c8a0 100644 --- a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/ShardingSphereConnection.java +++ b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/ShardingSphereConnection.java @@ -265,28 +265,22 @@ public void setReadOnly(final boolean readOnly) throws SQLException { databaseConnectionManager.setReadOnly(readOnly); } - /** - * This is just to avoid the Warning in brettwooldridge/HikariCP#2196. - * ShardingSphere does not propagate this property to the real JDBC Driver. - * `0` is actually the default value of {@link java.net.Socket#getSoTimeout()}. + /* + * This is just to avoid the Warning in brettwooldridge/HikariCP#2196. ShardingSphere does not propagate this property to the + * real JDBC Driver. `0` is actually the default value of {@link java.net.Socket#getSoTimeout()}. */ @Override public int getNetworkTimeout() { return 0; } - /** - * This is just to avoid the Warning in brettwooldridge/HikariCP#2196. - * ShardingSphere does not propagate this property to the real JDBC Driver. - * - * @param executor Not used. - * @param milliseconds The time in milliseconds to wait for the database operation to complete. + /* + * This is just to avoid the Warning in brettwooldridge/HikariCP#2196. ShardingSphere does not propagate this property to the + * real JDBC Driver. */ @Override public void setNetworkTimeout(final Executor executor, final int milliseconds) throws SQLException { - if (0 > milliseconds) { - throw new SQLException("Network timeout must be a value greater than or equal to 0."); - } + ShardingSpherePreconditions.checkState(0 <= milliseconds, () -> new SQLException("Network timeout must be a value greater than or equal to 0.")); } @Override