Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Iotdb
提交
63c992a7
I
Iotdb
项目概览
apache
/
Iotdb
12 个月 前同步成功
通知
25
Star
3344
Fork
916
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
Iotdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
63c992a7
编写于
9月 04, 2019
作者:
Q
qiaojialin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make session thread safe
上级
d1e305f4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
12 deletion
+10
-12
session/src/main/java/org/apache/iotdb/session/Session.java
session/src/main/java/org/apache/iotdb/session/Session.java
+10
-12
未找到文件。
session/src/main/java/org/apache/iotdb/session/Session.java
浏览文件 @
63c992a7
...
...
@@ -32,8 +32,6 @@ import org.apache.thrift.protocol.TBinaryProtocol;
import
org.apache.thrift.protocol.TCompactProtocol
;
import
org.apache.thrift.transport.TSocket
;
import
org.apache.thrift.transport.TTransportException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.time.ZoneId
;
...
...
@@ -44,7 +42,7 @@ public class Session {
private
String
username
;
private
String
password
;
private
final
TSProtocolVersion
protocolVersion
=
TSProtocolVersion
.
IOTDB_SERVICE_PROTOCOL_V1
;
p
ublic
TSIService
.
Iface
client
=
null
;
p
rivate
TSIService
.
Iface
client
=
null
;
private
TS_SessionHandle
sessionHandle
=
null
;
private
TSocket
transport
;
private
boolean
isClosed
=
true
;
...
...
@@ -65,11 +63,11 @@ public class Session {
this
.
password
=
password
;
}
public
void
open
()
throws
IoTDBSessionException
{
public
synchronized
void
open
()
throws
IoTDBSessionException
{
open
(
false
,
0
);
}
public
void
open
(
boolean
enableRPCCompression
,
int
connectionTimeoutInMs
)
public
synchronized
void
open
(
boolean
enableRPCCompression
,
int
connectionTimeoutInMs
)
throws
IoTDBSessionException
{
if
(!
isClosed
)
{
return
;
...
...
@@ -125,7 +123,7 @@ public class Session {
}
public
void
close
()
throws
IoTDBSessionException
{
public
synchronized
void
close
()
throws
IoTDBSessionException
{
if
(
isClosed
)
{
return
;
}
...
...
@@ -142,7 +140,7 @@ public class Session {
}
}
public
TSExecuteBatchStatementResp
insertBatch
(
RowBatch
rowBatch
)
throws
IoTDBSessionException
{
public
synchronized
TSExecuteBatchStatementResp
insertBatch
(
RowBatch
rowBatch
)
throws
IoTDBSessionException
{
TSBatchInsertionReq
request
=
new
TSBatchInsertionReq
();
request
.
deviceId
=
rowBatch
.
deviceId
;
for
(
MeasurementSchema
measurementSchema:
rowBatch
.
measurements
)
{
...
...
@@ -160,7 +158,7 @@ public class Session {
}
}
public
TSRPCResp
insert
(
String
deviceId
,
long
time
,
List
<
String
>
measurements
,
List
<
String
>
values
)
public
synchronized
TSRPCResp
insert
(
String
deviceId
,
long
time
,
List
<
String
>
measurements
,
List
<
String
>
values
)
throws
IoTDBSessionException
{
TSInsertReq
request
=
new
TSInsertReq
();
request
.
setDeviceId
(
deviceId
);
...
...
@@ -175,7 +173,7 @@ public class Session {
}
}
public
TSRPCResp
setStorageGroup
(
String
storageGroupId
)
throws
IoTDBSessionException
{
public
synchronized
TSRPCResp
setStorageGroup
(
String
storageGroupId
)
throws
IoTDBSessionException
{
TSSetStorageGroupReq
request
=
new
TSSetStorageGroupReq
();
request
.
setStorageGroupId
(
storageGroupId
);
...
...
@@ -186,7 +184,7 @@ public class Session {
}
}
public
TSRPCResp
createTimeseries
(
String
path
,
TSDataType
dataType
,
TSEncoding
encoding
,
CompressionType
compressor
)
throws
IoTDBSessionException
{
public
synchronized
TSRPCResp
createTimeseries
(
String
path
,
TSDataType
dataType
,
TSEncoding
encoding
,
CompressionType
compressor
)
throws
IoTDBSessionException
{
TSCreateTimeseriesReq
request
=
new
TSCreateTimeseriesReq
();
request
.
setPath
(
path
);
request
.
setDataType
(
dataType
.
ordinal
());
...
...
@@ -200,7 +198,7 @@ public class Session {
}
}
public
String
getTimeZone
()
throws
TException
,
IoTDBRPCException
{
public
synchronized
String
getTimeZone
()
throws
TException
,
IoTDBRPCException
{
if
(
zoneId
!=
null
)
{
return
zoneId
.
toString
();
}
...
...
@@ -210,7 +208,7 @@ public class Session {
return
resp
.
getTimeZone
();
}
public
void
setTimeZone
(
String
zoneId
)
throws
TException
,
IoTDBRPCException
{
public
synchronized
void
setTimeZone
(
String
zoneId
)
throws
TException
,
IoTDBRPCException
{
TSSetTimeZoneReq
req
=
new
TSSetTimeZoneReq
(
zoneId
);
TSRPCResp
resp
=
client
.
setTimeZone
(
req
);
RpcUtils
.
verifySuccess
(
resp
.
getStatus
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录