Explorar o código

ZOOKEEPER-3097: Using Runnable instead of thread work items to improve the throughput of CommitProcessor

Author: Fangmin Lyu <allenlyu@fb.com>

Reviewers: Michael Han <hanm@apache.org>

Closes #578 from lvfangmin/ZOOKEEPER-3097
Fangmin Lyu %!s(int64=7) %!d(string=hai) anos
pai
achega
75c652f450

+ 2 - 9
src/java/main/org/apache/zookeeper/server/WorkerService.java

@@ -133,21 +133,14 @@ public class WorkerService {
         } else {
             // When there is no worker thread pool, do the work directly
             // and wait for its completion
-            scheduledWorkRequest.start();
-            try {
-                scheduledWorkRequest.join();
-            } catch (InterruptedException e) {
-                LOG.warn("Unexpected exception", e);
-                Thread.currentThread().interrupt();
-            }
+            scheduledWorkRequest.run();
         }
     }
 
-    private class ScheduledWorkRequest extends ZooKeeperThread {
+    private class ScheduledWorkRequest implements Runnable {
         private final WorkRequest workRequest;
 
         ScheduledWorkRequest(WorkRequest workRequest) {
-            super("ScheduledWorkRequest");
             this.workRequest = workRequest;
         }