diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBResultSet.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBResultSet.java index 84a3f58f4692a99737af7d93c5578fc7a5a09c27..a8a8b3ca876cf1d2cbc9363b49f0f49da7550b90 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBResultSet.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBResultSet.java @@ -39,7 +39,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -@SuppressWarnings("unused") public class TSDBResultSet implements ResultSet { private TSDBJNIConnector jniConnector = null; @@ -104,6 +103,7 @@ public class TSDBResultSet implements ResultSet { } public TSDBResultSet() { + } public TSDBResultSet(TSDBJNIConnector connector, long resultSetPointer) throws SQLException { diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java index 56e6d73a014a84280691a6a0c016cb5d3e712696..381f1d3622a393cd47361c6e367e310d29fc5d72 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java @@ -68,12 +68,6 @@ public class TSDBStatement implements Statement { // TODO make sure it is not a update query pSql = this.connector.executeQuery(sql); - try { - TimeUnit.SECONDS.sleep(10); - } catch (InterruptedException e) { - e.printStackTrace(); - } - long resultSetPointer = this.connector.getResultSet(); if (resultSetPointer == TSDBConstants.JNI_CONNECTION_NULL) { this.connector.freeResultSet(pSql); diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiThreadsWithSameStatmentTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiThreadsWithSameStatmentTest.java index 3dc2f9680c774d94934f87a197e8de6d1b12018d..5cb76cc0cb71e1cb879b696d05cc6682f93d0bdc 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiThreadsWithSameStatmentTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiThreadsWithSameStatmentTest.java @@ -1,13 +1,11 @@ package com.taosdata.jdbc.cases; import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; import java.sql.*; import java.util.concurrent.TimeUnit; -import java.util.stream.IntStream; public class MultiThreadsWithSameStatmentTest { @@ -28,7 +26,7 @@ public class MultiThreadsWithSameStatmentTest { } } - public void release(){ + public void release() { try { stmt.close(); conn.close(); @@ -63,13 +61,16 @@ public class MultiThreadsWithSameStatmentTest { }); Thread t2 = new Thread(() -> { - try { - Service service = new Service(); - service.stmt.executeUpdate("insert into jdbctest.weather values(now,1)"); - service.release(); - } catch (SQLException e) { - e.printStackTrace(); + while (true) { + try { + Service service = new Service(); + service.stmt.executeUpdate("insert into jdbctest.weather values(now,1)"); + service.release(); + } catch (SQLException e) { + e.printStackTrace(); + } } + }); t1.start(); sleep(1000);