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


##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java:
##########
@@ -157,7 +158,7 @@ synchronized int process(Event event) {
   private final int maxOutstandingInstallSnapshots;
   private final TimeoutExecutor scheduler = TimeoutExecutor.getInstance();
 
-  private volatile StreamObservers appendLogRequestObserver;
+  private AtomicReference<StreamObservers> appendLogRequestObserver = new 
AtomicReference<>();

Review Comment:
   Let's suppress the warning?  WRITE is protected by `writeLock` while READ is 
protected `volatile`.



##########
ratis-common/src/main/java/org/apache/ratis/util/MemoizedSupplier.java:
##########
@@ -40,6 +40,7 @@ public static <T> MemoizedSupplier<T> valueOf(Supplier<T> 
supplier) {
   }
 
   private final Supplier<T> initializer;
+  @SuppressWarnings({"squid:S3077"}) // Suppress volatile for immutable object 
warning

Review Comment:
   Let's change the comment to
   ```java
   // Suppress volatile for generic type
   ```



##########
ratis-common/src/main/java/org/apache/ratis/util/MemoizedCheckedSupplier.java:
##########
@@ -44,6 +44,8 @@ public static <RETURN, THROW extends Throwable> 
MemoizedCheckedSupplier<RETURN,
   }
 
   private final CheckedSupplier<RETURN, THROW> initializer;
+
+  @SuppressWarnings({"squid:S3077"}) // Suppress volatile for immutable object 
warning

Review Comment:
   Let's change the comment to
   ```java
   // Suppress volatile for generic type
   ```



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