This commit is contained in:
zyyang 2021-01-15 17:56:54 +08:00
parent bee49162ff
commit 456f2a82f2
3 changed files with 11 additions and 16 deletions

View File

@ -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 {

View File

@ -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);

View File

@ -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,6 +61,7 @@ public class MultiThreadsWithSameStatmentTest {
});
Thread t2 = new Thread(() -> {
while (true) {
try {
Service service = new Service();
service.stmt.executeUpdate("insert into jdbctest.weather values(now,1)");
@ -70,6 +69,8 @@ public class MultiThreadsWithSameStatmentTest {
} catch (SQLException e) {
e.printStackTrace();
}
}
});
t1.start();
sleep(1000);