adoroszlai commented on code in PR #5491:
URL: https://github.com/apache/ozone/pull/5491#discussion_r1372757363


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/OzoneContainer.java:
##########
@@ -296,8 +296,10 @@ private void buildContainerSet() {
     ContainerInspectorUtil.load();
     while (volumeSetIterator.hasNext()) {
       StorageVolume volume = volumeSetIterator.next();
-      Thread thread = new Thread(new ContainerReader(volumeSet,
-          (HddsVolume) volume, containerSet, config, true));
+      ContainerReader containerReader = new ContainerReader(volumeSet,
+          (HddsVolume) volume, containerSet, config, true);
+      Thread thread = new Thread(containerReader,
+          datanodeDetails.threadNamePrefix());

Review Comment:
   Each thread should have some unique ID in addition to the prefix.  I think 
we can achieve that most easily by creating a thread factory outside of the 
loop:
   
   ```
       String threadNamePrefix = datanodeDetails.threadNamePrefix();
       ThreadFactory threadFactory = new ThreadFactoryBuilder()
           .setDaemon(true)
           .setNameFormat(threadNamePrefix + "ContainerReader-%d")
           .build();
   ```
   
   then use it to create the threads in the loop:
   
   ```
         Thread thread = threadFactory.newThread(containerReader);
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to