Caideyipi commented on code in PR #12275:
URL: https://github.com/apache/iotdb/pull/12275#discussion_r1549016186


##########
iotdb-client/session/src/main/java/org/apache/iotdb/session/subscription/SubscriptionProvider.java:
##########
@@ -81,11 +87,49 @@ public synchronized void close() throws 
IoTDBConnectionException {
       throw new IoTDBConnectionException(e);
     } finally {
       super.close();
+      setUnavailable();
       isClosed.set(true);
     }
   }
 
   SubscriptionSessionConnection getSessionConnection() {
     return (SubscriptionSessionConnection) defaultSessionConnection;
   }
+
+  boolean isAvailable() {
+    return isAvailable.get();
+  }
+
+  void setAvailable() {
+    isAvailable.set(true);
+  }
+
+  void setUnavailable() {
+    isAvailable.set(false);
+  }
+
+  int getDataNodeId() {
+    return dataNodeId;
+  }
+
+  TEndPoint getEndPoint() {
+    return endPoint;
+  }
+
+  @Override
+  public String toString() {
+    return "{endPoint="

Review Comment:
   Better add the class name here.



##########
iotdb-client/session/src/main/java/org/apache/iotdb/session/subscription/SubscriptionProvider.java:
##########
@@ -81,11 +87,49 @@ public synchronized void close() throws 
IoTDBConnectionException {
       throw new IoTDBConnectionException(e);
     } finally {
       super.close();
+      setUnavailable();
       isClosed.set(true);
     }
   }
 
   SubscriptionSessionConnection getSessionConnection() {
     return (SubscriptionSessionConnection) defaultSessionConnection;
   }
+
+  boolean isAvailable() {
+    return isAvailable.get();
+  }
+
+  void setAvailable() {
+    isAvailable.set(true);
+  }
+
+  void setUnavailable() {
+    isAvailable.set(false);
+  }
+
+  int getDataNodeId() {
+    return dataNodeId;
+  }
+
+  TEndPoint getEndPoint() {
+    return endPoint;
+  }
+
+  @Override
+  public String toString() {
+    return "{endPoint="
+        + endPoint
+        + ", dataNodeId="
+        + dataNodeId
+        + ", consumerId="
+        + consumerId
+        + ", consumerGroupId="
+        + consumerGroupId
+        + ", isAvailable="
+        + isAvailable

Review Comment:
   Better use "get()" to print the atomic values, or else you may get the 
memory address of the atomic variable.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to