You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/07/27 07:02:37 UTC

[GitHub] [iotdb] qiaojialin commented on a diff in pull request #6783: [To rel/0.13] [IOTDB-3943] Optimize session timeout feature

qiaojialin commented on code in PR #6783:
URL: https://github.com/apache/iotdb/pull/6783#discussion_r930676905


##########
server/src/main/java/org/apache/iotdb/db/query/control/SessionTimeoutManager.java:
##########
@@ -106,6 +106,13 @@ public static SessionTimeoutManager getInstance() {
     return SessionTimeoutManagerHelper.INSTANCE;
   }
 
+  public boolean isSessionExits(long sessionId) {

Review Comment:
   ```suggestion
     public boolean isSessionAlive(long sessionId) {
   ```



##########
service-rpc/src/main/java/org/apache/iotdb/rpc/SessionTimeoutException.java:
##########
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.rpc;
+
+import org.apache.iotdb.service.rpc.thrift.TSStatus;
+
+public class SessionTimeoutException extends StatementExecutionException {

Review Comment:
   ```suggestion
   public class SessionTimeoutException extends IoTDBConnectionException {
   ```



##########
server/src/main/java/org/apache/iotdb/db/service/basic/ServiceProvider.java:
##########
@@ -109,12 +109,26 @@ public boolean checkLogin(long sessionId) {
     boolean isLoggedIn = currSessionId != null && currSessionId == sessionId;
     if (!isLoggedIn) {
       LOGGER.info("{}: Not login. ", IoTDBConstant.GLOBAL_DB_NAME);
+      return false;
     } else {
       SessionTimeoutManager.getInstance().refresh(sessionId);
     }
     return isLoggedIn;
   }
 
+  /**
+   * Check whether current session is timeout.
+   *
+   * @param sessionId Session id.
+   * @return true: If session timeout; false: If not session timeout.
+   */
+  public boolean checkSessionTimeout(long sessionId) {

Review Comment:
   ```suggestion
     public boolean isSessionTimeout(long sessionId) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org