提交 456f2a82 编写于 作者: Z zyyang

change

上级 bee49162
...@@ -39,7 +39,6 @@ import java.util.Iterator; ...@@ -39,7 +39,6 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@SuppressWarnings("unused")
public class TSDBResultSet implements ResultSet { public class TSDBResultSet implements ResultSet {
private TSDBJNIConnector jniConnector = null; private TSDBJNIConnector jniConnector = null;
...@@ -104,6 +103,7 @@ public class TSDBResultSet implements ResultSet { ...@@ -104,6 +103,7 @@ public class TSDBResultSet implements ResultSet {
} }
public TSDBResultSet() { public TSDBResultSet() {
} }
public TSDBResultSet(TSDBJNIConnector connector, long resultSetPointer) throws SQLException { public TSDBResultSet(TSDBJNIConnector connector, long resultSetPointer) throws SQLException {
......
...@@ -68,12 +68,6 @@ public class TSDBStatement implements Statement { ...@@ -68,12 +68,6 @@ public class TSDBStatement implements Statement {
// TODO make sure it is not a update query // TODO make sure it is not a update query
pSql = this.connector.executeQuery(sql); pSql = this.connector.executeQuery(sql);
try {
TimeUnit.SECONDS.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
long resultSetPointer = this.connector.getResultSet(); long resultSetPointer = this.connector.getResultSet();
if (resultSetPointer == TSDBConstants.JNI_CONNECTION_NULL) { if (resultSetPointer == TSDBConstants.JNI_CONNECTION_NULL) {
this.connector.freeResultSet(pSql); this.connector.freeResultSet(pSql);
......
package com.taosdata.jdbc.cases; package com.taosdata.jdbc.cases;
import org.junit.After; import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import java.sql.*; import java.sql.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.IntStream;
public class MultiThreadsWithSameStatmentTest { public class MultiThreadsWithSameStatmentTest {
...@@ -28,7 +26,7 @@ public class MultiThreadsWithSameStatmentTest { ...@@ -28,7 +26,7 @@ public class MultiThreadsWithSameStatmentTest {
} }
} }
public void release(){ public void release() {
try { try {
stmt.close(); stmt.close();
conn.close(); conn.close();
...@@ -63,13 +61,16 @@ public class MultiThreadsWithSameStatmentTest { ...@@ -63,13 +61,16 @@ public class MultiThreadsWithSameStatmentTest {
}); });
Thread t2 = new Thread(() -> { Thread t2 = new Thread(() -> {
try { while (true) {
Service service = new Service(); try {
service.stmt.executeUpdate("insert into jdbctest.weather values(now,1)"); Service service = new Service();
service.release(); service.stmt.executeUpdate("insert into jdbctest.weather values(now,1)");
} catch (SQLException e) { service.release();
e.printStackTrace(); } catch (SQLException e) {
e.printStackTrace();
}
} }
}); });
t1.start(); t1.start();
sleep(1000); sleep(1000);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册