You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/03/14 16:37:46 UTC

[GitHub] merlimat commented on a change in pull request #1258: Allow to send callbacks from journal thread

merlimat commented on a change in pull request #1258: Allow to send callbacks from journal thread
URL: https://github.com/apache/bookkeeper/pull/1258#discussion_r174526405
 
 

 ##########
 File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
 ##########
 @@ -625,8 +626,12 @@ public Journal(File journalDirectory, ServerConfiguration conf, LedgerDirsManage
         this.maxGroupWaitInNanos = TimeUnit.MILLISECONDS.toNanos(conf.getJournalMaxGroupWaitMSec());
         this.bufferedWritesThreshold = conf.getJournalBufferedWritesThreshold();
         this.bufferedEntriesThreshold = conf.getJournalBufferedEntriesThreshold();
-        this.cbThreadPool = Executors.newFixedThreadPool(conf.getNumJournalCallbackThreads(),
-                                                         new DaemonThreadFactory());
+        if (conf.getNumJournalCallbackThreads() > 0) {
+            this.cbThreadPool = Executors.newFixedThreadPool(conf.getNumJournalCallbackThreads(),
+                                                         new DefaultThreadFactory("bookie-journal-callback"));
+        } else {
+            this.cbThreadPool = MoreExecutors.newDirectExecutorService();
 
 Review comment:
   I think it would be anyway either one case or the other. 
   
   I think though that it should be safe anyway. If you have a "direct" executor, it is like a dummy executor. 
   
   We could have threads `t1` and `t2` sharing the same instance. when `t1` submits one task, it gets executed immediately in `t1`. `t2` tasks will be executed in `t2` thread.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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