Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
84046cdb
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
84046cdb
编写于
2月 25, 2022
作者:
H
huolibo
提交者:
GitHub
2月 25, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix multi call close error (#10412)
上级
d36d0dd0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
20 addition
and
15 deletion
+20
-15
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java
...dbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java
+1
-2
src/connector/jdbc/src/main/java/com/taosdata/jdbc/ws/AbstractWSResultSet.java
...c/main/java/com/taosdata/jdbc/ws/AbstractWSResultSet.java
+9
-5
src/connector/jdbc/src/main/java/com/taosdata/jdbc/ws/WSClient.java
...tor/jdbc/src/main/java/com/taosdata/jdbc/ws/WSClient.java
+0
-1
src/connector/jdbc/src/main/java/com/taosdata/jdbc/ws/WSStatement.java
.../jdbc/src/main/java/com/taosdata/jdbc/ws/WSStatement.java
+5
-1
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaDataTest.java
...ava/com/taosdata/jdbc/rs/RestfulDatabaseMetaDataTest.java
+4
-3
src/connector/jdbc/src/test/java/com/taosdata/jdbc/ws/WSQueryTest.java
.../jdbc/src/test/java/com/taosdata/jdbc/ws/WSQueryTest.java
+1
-3
未找到文件。
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java
浏览文件 @
84046cdb
...
...
@@ -65,8 +65,7 @@ public class RestfulDriver extends AbstractDriver {
}
String
loginUrl
;
String
batchLoad
=
info
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_BATCH_LOAD
);
// if (Boolean.parseBoolean(batchLoad)) {
if
(
false
)
{
if
(
Boolean
.
parseBoolean
(
batchLoad
))
{
loginUrl
=
"ws://"
+
props
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_HOST
)
+
":"
+
props
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_PORT
)
+
"/rest/ws"
;
WSClient
client
;
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/ws/AbstractWSResultSet.java
浏览文件 @
84046cdb
...
...
@@ -25,7 +25,7 @@ public abstract class AbstractWSResultSet extends AbstractResultSet {
protected
final
RequestFactory
factory
;
protected
final
long
queryId
;
protected
boolean
isClosed
;
protected
volatile
boolean
isClosed
;
// meta
protected
final
ResultSetMetaData
metaData
;
protected
final
List
<
RestfulResultSet
.
Field
>
fields
=
new
ArrayList
<>();
...
...
@@ -105,10 +105,14 @@ public abstract class AbstractWSResultSet extends AbstractResultSet {
@Override
public
void
close
()
throws
SQLException
{
this
.
isClosed
=
true
;
if
(
result
!=
null
&&
!
result
.
isEmpty
()
&&
!
isCompleted
)
{
FetchReq
fetchReq
=
new
FetchReq
(
queryId
,
queryId
);
transport
.
sendWithoutRep
(
new
Request
(
Action
.
FREE_RESULT
.
getAction
(),
fetchReq
));
synchronized
(
this
)
{
if
(!
this
.
isClosed
)
{
this
.
isClosed
=
true
;
if
(
result
!=
null
&&
!
result
.
isEmpty
()
&&
!
isCompleted
)
{
FetchReq
fetchReq
=
new
FetchReq
(
queryId
,
queryId
);
transport
.
sendWithoutRep
(
new
Request
(
Action
.
FREE_RESULT
.
getAction
(),
fetchReq
));
}
}
}
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/ws/WSClient.java
浏览文件 @
84046cdb
...
...
@@ -95,7 +95,6 @@ public class WSClient extends WebSocketClient implements AutoCloseable {
long
id
=
bytes
.
getLong
();
ResponseFuture
remove
=
inFlightRequest
.
remove
(
Action
.
FETCH_BLOCK
.
getAction
(),
id
);
if
(
null
!=
remove
)
{
// FetchBlockResp fetchBlockResp = new FetchBlockResp(id, bytes.slice());
FetchBlockResp
fetchBlockResp
=
new
FetchBlockResp
(
id
,
bytes
);
remove
.
getFuture
().
complete
(
fetchBlockResp
);
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/ws/WSStatement.java
浏览文件 @
84046cdb
...
...
@@ -53,8 +53,12 @@ public class WSStatement extends AbstractStatement {
@Override
public
void
close
()
throws
SQLException
{
if
(!
isClosed
())
if
(!
isClosed
())
{
this
.
closed
=
true
;
if
(
resultSet
!=
null
&&
!
resultSet
.
isClosed
())
{
resultSet
.
close
();
}
}
}
@Override
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaDataTest.java
浏览文件 @
84046cdb
...
...
@@ -15,6 +15,7 @@ public class RestfulDatabaseMetaDataTest {
private
static
final
String
url
=
"jdbc:TAOS-RS://"
+
host
+
":6041/?user=root&password=taosdata"
;
private
static
Connection
connection
;
private
static
RestfulDatabaseMetaData
metaData
;
private
static
final
String
dbName
=
"test"
;
@Test
public
void
unwrap
()
throws
SQLException
{
...
...
@@ -1092,9 +1093,9 @@ public class RestfulDatabaseMetaDataTest {
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_TIME_ZONE
,
"UTC-8"
);
connection
=
DriverManager
.
getConnection
(
url
,
properties
);
Statement
stmt
=
connection
.
createStatement
();
stmt
.
execute
(
"drop database if exists
log"
);
stmt
.
execute
(
"create database if not exists
log
precision 'us'"
);
stmt
.
execute
(
"use
log"
);
stmt
.
execute
(
"drop database if exists
"
+
dbName
);
stmt
.
execute
(
"create database if not exists
"
+
dbName
+
"
precision 'us'"
);
stmt
.
execute
(
"use
"
+
dbName
);
stmt
.
execute
(
"create table `dn` (ts TIMESTAMP,cpu_taosd FLOAT,cpu_system FLOAT,cpu_cores INT,mem_taosd FLOAT,mem_system FLOAT,mem_total INT,disk_used FLOAT,disk_total INT,band_speed FLOAT,io_read FLOAT,io_write FLOAT,req_http INT,req_select INT,req_insert INT) TAGS (dnodeid INT,fqdn BINARY(128))"
);
stmt
.
execute
(
"insert into dn1 using dn tags(1,'a') (ts) values(now)"
);
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/ws/WSQueryTest.java
浏览文件 @
84046cdb
...
...
@@ -32,9 +32,7 @@ public class WSQueryTest {
public
void
queryBlock
()
throws
InterruptedException
{
CountDownLatch
latch
=
new
CountDownLatch
(
1000
);
IntStream
.
range
(
1
,
10000
).
limit
(
1000
).
parallel
().
forEach
(
x
->
{
try
{
Statement
statement
=
connection
.
createStatement
();
try
(
Statement
statement
=
connection
.
createStatement
())
{
statement
.
execute
(
"insert into "
+
databaseName
+
"."
+
tableName
+
" values(now+100s, 100)"
);
ResultSet
resultSet
=
statement
.
executeQuery
(
"select * from "
+
databaseName
+
"."
+
tableName
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录