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


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/ServerImplUtils.java:
##########
@@ -170,8 +171,8 @@ public static RaftServerProxy newRaftServer(
       ThreadGroup threadGroup, RaftProperties properties, Parameters 
parameters) throws IOException {
     RaftServer.LOG.debug("newRaftServer: {}, {}", id, group);
     if (group != null && !group.getPeers().isEmpty()) {
-      Preconditions.assertNotNull(id, "RaftPeerId %s is not in RaftGroup %s", 
id, group);
-      Preconditions.assertNotNull(group.getPeer(id), "RaftPeerId %s is not in 
RaftGroup %s", id, group);
+      Objects.requireNonNull(id, "RaftPeerId " + id + " is not in RaftGroup " 
+ group);
+      Objects.requireNonNull(group.getPeer(id), "RaftPeerId " + id + " is not 
in RaftGroup " + group);

Review Comment:
   We should use Supplier in order to avoid unnecessarily creating the string.



##########
ratis-common/src/main/java/org/apache/ratis/util/ReferenceCountedLeakDetector.java:
##########
@@ -202,7 +203,7 @@ public synchronized boolean release() {
       }
 
       if (released) {
-        Preconditions.assertNotNull(removeMethod, () -> "Not yet retained 
(removeMethod == null): " + valueClass);
+        Objects.requireNonNull(removeMethod, "Not yet retained (removeMethod 
== null): " + valueClass);

Review Comment:
   We should keep using the Supplier in order to avoid unnecessarily creating 
the string.
   ```java
   Objects.requireNonNull(removeMethod, () -> "Not yet retained (removeMethod 
== null): " + valueClass);
   ```



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