Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
98624f57
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
98624f57
编写于
11月 20, 2020
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change
上级
967f1ab2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
6 addition
and
11 deletion
+6
-11
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
...r/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
+0
-7
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultPointerExceptionTest.java
...aosdata/jdbc/cases/InvalidResultPointerExceptionTest.java
+6
-4
未找到文件。
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java
浏览文件 @
98624f57
...
@@ -172,20 +172,14 @@ public class TSDBStatement implements Statement {
...
@@ -172,20 +172,14 @@ public class TSDBStatement implements Statement {
}
}
public
boolean
execute
(
String
sql
)
throws
SQLException
{
public
boolean
execute
(
String
sql
)
throws
SQLException
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss.SSS"
);
System
.
out
.
println
(
Thread
.
currentThread
().
getName
()
+
" before execute "
+
sdf
.
format
(
new
Date
())
+
"=====> isclosed: "
+
isClosed
);
if
(
isClosed
)
{
if
(
isClosed
)
{
System
.
out
.
println
(
Thread
.
currentThread
().
getName
()
+
" will throw "
+
sdf
.
format
(
new
Date
())
+
"=====> isclosed: "
+
isClosed
);
throw
new
SQLException
(
"Invalid method call on a closed statement."
);
throw
new
SQLException
(
"Invalid method call on a closed statement."
);
}
}
boolean
res
=
true
;
boolean
res
=
true
;
System
.
out
.
println
(
Thread
.
currentThread
().
getName
()
+
" before JNI "
+
sdf
.
format
(
new
Date
())
+
"=====> isclosed: "
+
isClosed
);
pSql
=
this
.
connector
.
executeQuery
(
sql
);
pSql
=
this
.
connector
.
executeQuery
(
sql
);
System
.
out
.
println
(
Thread
.
currentThread
().
getName
()
+
" after JNI "
+
sdf
.
format
(
new
Date
())
+
"=====> isclosed: "
+
isClosed
);
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
);
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
));
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
));
...
@@ -194,7 +188,6 @@ public class TSDBStatement implements Statement {
...
@@ -194,7 +188,6 @@ public class TSDBStatement implements Statement {
this
.
connector
.
freeResultSet
(
pSql
);
this
.
connector
.
freeResultSet
(
pSql
);
res
=
false
;
res
=
false
;
}
}
System
.
out
.
println
(
Thread
.
currentThread
().
getName
()
+
" after execute "
+
System
.
currentTimeMillis
()
+
" =====> isclosed: "
+
isClosed
);
return
res
;
return
res
;
}
}
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultPointerExceptionTest.java
浏览文件 @
98624f57
...
@@ -30,13 +30,14 @@ public class InvalidResultPointerExceptionTest {
...
@@ -30,13 +30,14 @@ public class InvalidResultPointerExceptionTest {
@Test
@Test
public
void
testInvalidResultPointerException
()
{
public
void
testInvalidResultPointerException
()
{
try
(
Connection
conn
=
TSDBCommon
.
getConn
(
"localhost"
))
{
try
(
Connection
conn
=
TSDBCommon
.
getConn
(
"localhost"
))
{
Statement
stmt
=
conn
.
createStatement
();
List
<
Thread
>
threads
=
IntStream
.
range
(
1
,
2
).
boxed
().
map
(
i
->
new
Thread
(()
->
{
List
<
Thread
>
threads
=
IntStream
.
range
(
1
,
2
).
boxed
().
map
(
i
->
new
Thread
(()
->
{
while
(
true
)
{
while
(
true
)
{
String
sql
=
"insert into irp_test.weather values(now, "
+
random
.
nextInt
(
100
)
+
")"
;
String
sql
=
"insert into irp_test.weather values(now, "
+
random
.
nextInt
(
100
)
+
")"
;
try
{
try
{
Statement
stmt
=
conn
.
createStatement
();
stmt
.
execute
(
sql
);
stmt
.
execute
(
sql
);
stmt
.
close
();
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -49,11 +50,12 @@ public class InvalidResultPointerExceptionTest {
...
@@ -49,11 +50,12 @@ public class InvalidResultPointerExceptionTest {
}
}
},
"Thread-"
+
i
)).
collect
(
Collectors
.
toList
());
},
"Thread-"
+
i
)).
collect
(
Collectors
.
toList
());
for
(
int
i
=
0
;
i
<
threads
.
size
();
i
++)
{
for
(
Thread
thread
:
threads
)
threads
.
get
(
i
).
join
();
thread
.
start
();
for
(
Thread
thread
:
threads
)
{
thread
.
join
();
}
}
stmt
.
close
();
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
catch
(
ClassNotFoundException
e
)
{
}
catch
(
ClassNotFoundException
e
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录