This is an automated email from the ASF dual-hosted git repository.

zjffdu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/master by this push:
     new 04b3f47  [ZEPPELIN-4469]. Cron is disabled after zeppelin restart
04b3f47 is described below

commit 04b3f479c99e69fa351f0bc945a1625ff7b5bb61
Author: Jeff Zhang <zjf...@apache.org>
AuthorDate: Mon Dec 9 22:23:01 2019 +0800

    [ZEPPELIN-4469]. Cron is disabled after zeppelin restart
    
    ### What is this PR for?
    The root cause is that zeppelin didn't init cron job setting after zeppelin 
restart. This PR add one thread to list all notes to init the cron job. The 
reason to do in a separated thread is that there may be many notes, loop all 
notes in the main thread may block the restarting of Zeppelin server.
    
    ### What type of PR is it?
    [Bug Fix]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-4469
    
    ### How should this be tested?
    * Test it manually.
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Jeff Zhang <zjf...@apache.org>
    
    Closes #3542 from zjffdu/ZEPPELIN-4469 and squashes the following commits:
    
    7bc6491fd [Jeff Zhang] address comment
    4b9876c5d [Jeff Zhang] [ZEPPELIN-4469]. Cron is disabled after zeppelin 
restart
---
 .../zeppelin/notebook/scheduler/QuartzSchedulerService.java  | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/scheduler/QuartzSchedulerService.java
 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/scheduler/QuartzSchedulerService.java
index ee174d0..b96c6ff 100644
--- 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/scheduler/QuartzSchedulerService.java
+++ 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/scheduler/QuartzSchedulerService.java
@@ -54,6 +54,18 @@ public class QuartzSchedulerService implements 
SchedulerService {
     this.notebook = notebook;
     this.scheduler = new StdSchedulerFactory().getScheduler();
     this.scheduler.start();
+
+    // Do in a separated thread because there may be many notes,
+    // loop all notes in the main thread may block the restarting of Zeppelin 
server
+    Thread loadingNotesThread = new Thread(() -> {
+        LOGGER.info("Starting init cronjobs");
+        notebook.getNotesInfo().stream()
+                .forEach(entry -> refreshCron(entry.getId()));
+        LOGGER.info("Complete init cronjobs");
+    });
+    loadingNotesThread.setName("Init CronJob Thread");
+    loadingNotesThread.setDaemon(true);
+    loadingNotesThread.start();
   }
 
   @Override

Reply via email to