You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/11/04 18:31:30 UTC

[GitHub] [incubator-druid] leventov commented on a change in pull request #8808: use copy-on-write list in InMemoryAppender

leventov commented on a change in pull request #8808: use copy-on-write list in InMemoryAppender
URL: https://github.com/apache/incubator-druid/pull/8808#discussion_r342202395
 
 

 ##########
 File path: core/src/test/java/org/apache/druid/testing/junit/LoggerCaptureRule.java
 ##########
 @@ -78,12 +77,13 @@ public void clearLogEvents()
   {
     static final String NAME = InMemoryAppender.class.getName();
 
-    private final List<LogEvent> logEvents;
+    // need copy-on-write collection for thread safety of iteration and modification concurrently outside of a critical section
 
 Review comment:
   This comment doesn't achieve its goal: to help somebody to see why the enclosing class needs to be thread-safe. With the current comment, in order to do that, the reader (developer) should invoke "Find usages" IDE action and analyze these usages carefully. This is time-consuming. In essence, there should be concurrent access documentation, as described in https://github.com/code-review-checklists/java-concurrency#justify-document.
   
   This comment is also misleading because there are no critical sections in this code.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org