Vanlightly commented on a change in pull request #2887:
URL: https://github.com/apache/bookkeeper/pull/2887#discussion_r748059698



##########
File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieImpl.java
##########
@@ -714,12 +717,14 @@ public BookieImpl(ServerConfiguration conf, StatsLogger 
statsLogger,
                 this.stateManager.transitionToReadOnlyMode();
             }
         }
-
+        this.journalExistCountDown = new CountDownLatch(1);
         // instantiate the journals
         journals = Lists.newArrayList();
         for (int i = 0; i < journalDirectories.size(); i++) {
-            journals.add(new Journal(i, journalDirectories.get(i),
-                    conf, ledgerDirsManager, statsLogger.scope(JOURNAL_SCOPE), 
allocator));
+            Journal journal = new Journal(i, journalDirectories.get(i),
+                    conf, ledgerDirsManager, statsLogger.scope(JOURNAL_SCOPE), 
allocator);
+            journal.setThreadAliveCounterDown(journalExistCountDown);

Review comment:
       Better for dependencies to be injected through the constructor. Tests 
use one constructor, which doesn't need the latch, and the BookieImpl uses the 
other. So you won't need to update lots of tests.




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