You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2021/09/16 02:27:12 UTC
[iotdb] branch rel/0.12 updated: [IOTDB-1679] client-cpp: Session
descontruction need release server resource. (#3964) (#3972)
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch rel/0.12
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/0.12 by this push:
new 0e54f10 [IOTDB-1679] client-cpp: Session descontruction need release server resource. (#3964) (#3972)
0e54f10 is described below
commit 0e54f10509ce3cea30ec6f2452ae2fdc8b3846ee
Author: Haonan <hh...@outlook.com>
AuthorDate: Thu Sep 16 10:26:46 2021 +0800
[IOTDB-1679] client-cpp: Session descontruction need release server resource. (#3964) (#3972)
Co-authored-by: Jamber <ja...@sina.com>
---
client-cpp/src/main/Session.cpp | 6 ++++++
client-cpp/src/main/Session.h | 2 ++
example/client-cpp-example/src/SessionExample.cpp | 4 +++-
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/client-cpp/src/main/Session.cpp b/client-cpp/src/main/Session.cpp
index 2c56492..fdb1c00 100644
--- a/client-cpp/src/main/Session.cpp
+++ b/client-cpp/src/main/Session.cpp
@@ -345,6 +345,12 @@ void SessionDataSet::closeOperationHandle() {
}
}
+/**
+ * When delete variable, make sure release all resource.
+ */
+Session::~Session() {
+ close();
+}
/**
* check whether the batch has been sorted
diff --git a/client-cpp/src/main/Session.h b/client-cpp/src/main/Session.h
index 54dd353..e3e2e20 100644
--- a/client-cpp/src/main/Session.h
+++ b/client-cpp/src/main/Session.h
@@ -649,6 +649,8 @@ public:
this->zoneId = "UTC+08:00";
}
+ ~Session();
+
void open();
void open(bool enableRPCCompression);
diff --git a/example/client-cpp-example/src/SessionExample.cpp b/example/client-cpp-example/src/SessionExample.cpp
index 24bb013..7be7269 100644
--- a/example/client-cpp-example/src/SessionExample.cpp
+++ b/example/client-cpp-example/src/SessionExample.cpp
@@ -303,6 +303,8 @@ int main() {
deleteTimeseries();
session->close();
-
+
+ delete session;
+
return 0;
}