szetszwo commented on code in PR #1355:
URL: https://github.com/apache/ratis/pull/1355#discussion_r2834291446


##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/util/ZeroCopyMessageMarshaller.java:
##########
@@ -222,4 +222,30 @@ private T parseFrom(CodedInputStream stream) throws 
InvalidProtocolBufferExcepti
   public InputStream popStream(T message) {
     return unclosedStreams.remove(message);
   }
+
+  public int getUnclosedCount() {
+    return unclosedStreams.size();
+  }
+
+  public void checkLeaks(String context) {

Review Comment:
   - Let's call it `assertNoUnclosedStreams`.
   - The `context` parameter is not needed since if there is an exception, the 
stack trace will have the context.
   - Make it package private.
   
   ```java
     void assertNoUnclosedStreams() {
       final int size = unclosedStreams.size();
       Preconditions.assertTrue(size == 0, () -> name + ": " + size + " 
unclosed stream(s)");
     }
   ```



##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/util/ZeroCopyMessageMarshaller.java:
##########
@@ -222,4 +222,30 @@ private T parseFrom(CodedInputStream stream) throws 
InvalidProtocolBufferExcepti
   public InputStream popStream(T message) {
     return unclosedStreams.remove(message);
   }
+
+  public int getUnclosedCount() {

Review Comment:
   This method is only used once.  Let's remove it.  If there is a need in the 
future, we may add it at that time.



-- 
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