allenma commented on a change in pull request #443: KYLIN-3759 & KYLIN-3744
URL: https://github.com/apache/kylin/pull/443#discussion_r250099775
 
 

 ##########
 File path: 
stream-coordinator/src/main/java/org/apache/kylin/stream/coordinator/Coordinator.java
 ##########
 @@ -132,14 +143,37 @@ private Coordinator() {
         this.zkClient = ZKUtils.getZookeeperClient();
         this.selector = new CoordinatorLeaderSelector();
         this.jobStatusChecker = new StreamingBuildJobStatusChecker();
-        this.streamingJobCheckExecutor = Executors.newScheduledThreadPool(1, 
new NamedThreadFactory(
-                "streaming_job_status_checker"));
+        this.streamingJobCheckExecutor = Executors.newScheduledThreadPool(1,
+                new NamedThreadFactory("streaming_job_status_checker"));
         if (ServerMode.SERVER_MODE.canServeStreamingCoordinator()) {
             start();
         }
     }
 
-    public static Coordinator getInstance() {
+    @VisibleForTesting
+    protected Coordinator(StreamMetadataStore metadataStore, 
ReceiverAdminClient receiverClient) {
+        this.streamMetadataStore = metadataStore;
+        this.receiverAdminClient = receiverClient;
+        this.assigner = new DefaultAssigner();
+        this.zkClient = ZKUtils.getZookeeperClient();
+        this.selector = new CoordinatorLeaderSelector();
+        this.jobStatusChecker = new StreamingBuildJobStatusChecker();
+        this.streamingJobCheckExecutor = Executors.newScheduledThreadPool(1,
+                new NamedThreadFactory("streaming_job_status_checker"));
+        if (ServerMode.SERVER_MODE.canServeStreamingCoordinator()) {
+            start();
+        }
+        this.isLead = true;
+    }
+
+    public static synchronized Coordinator getInstance() {
 
 Review comment:
   late initialization here for unit test?
   no need synchronized on method level

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to