You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by al...@apache.org on 2020/04/27 19:05:12 UTC

[zeppelin] branch master updated: [ZEPPELIN-4772] Quartz scheduler

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

alexott 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 2ddc84e  [ZEPPELIN-4772] Quartz scheduler
2ddc84e is described below

commit 2ddc84eb822b69c12acdc6ec2ed10fc3a0f9390f
Author: Philipp Dallig <ph...@gmail.com>
AuthorDate: Mon Apr 27 17:25:19 2020 +0200

    [ZEPPELIN-4772] Quartz scheduler
    
    ### What is this PR for?
    Remove system property for quartz scheduler update check and some cleanup in Quartz-Scheduler.
    
    Update check was removed in https://github.com/quartz-scheduler/quartz/commit/e1f78465fae7d3e81d30487f7f47697ec9a30d87
    
    ### What type of PR is it?
    Bug Fix
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-4772
    
    ### How should this be tested?
    * Travis-CI: https://travis-ci.org/github/Reamer/zeppelin/builds/680159756
    
    ### 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: Philipp Dallig <ph...@gmail.com>
    
    Closes #3751 from Reamer/quartz_scheduler and squashes the following commits:
    
    bc79d97bb [Philipp Dallig] Remove system property for skipping quartz scheduler update check
    90d6fc801 [Philipp Dallig] Some cleanup in QuartzScheduler
---
 .../notebook/scheduler/QuartzSchedulerService.java | 34 +++++++++-------------
 1 file changed, 14 insertions(+), 20 deletions(-)

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 7b39a54..5139e35 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
@@ -68,14 +68,14 @@ public class QuartzSchedulerService implements SchedulerService {
                   try {
                     if (!refreshCron(entry.getId())) {
                       try {
-                        LOGGER.debug("Unload note: " + entry.getId());
+                        LOGGER.debug("Unload note: {}", entry.getId());
                         notebook.getNote(entry.getId()).unLoad();
                       } catch (Exception e) {
-                        LOGGER.warn("Fail to unload note: " + entry.getId(), e);
+                        LOGGER.warn("Fail to unload note: {}", entry.getId(), e);
                       }
                     }
                   } catch (Exception e) {
-                    LOGGER.warn("Fail to refresh cron for note: " + entry.getId());
+                    LOGGER.warn("Fail to refresh cron for note: {}", entry.getId());
                   }
                 });
         LOGGER.info("Complete init cronjobs");
@@ -86,9 +86,6 @@ public class QuartzSchedulerService implements SchedulerService {
   }
 
   private Scheduler getScheduler() throws SchedulerException {
-    // Make sure to not check for Quartz update since this leaks information about running process
-    // http://www.quartz-scheduler.org/documentation/2.4.0-SNAPSHOT/best-practices.html#skip-update-check
-    System.setProperty("org.terracotta.quartz.skipUpdateCheck", "true");
     return new StdSchedulerFactory().getScheduler();
   }
 
@@ -115,38 +112,35 @@ public class QuartzSchedulerService implements SchedulerService {
       return false;
     }
     if (note == null) {
-      LOGGER.warn("Skip refresh cron of note: " + noteId + " because there's no such note");
+      LOGGER.warn("Skip refresh cron of note: {} because there's no such note", noteId);
       return false;
     }
     if (note.isTrash()) {
-      LOGGER.warn("Skip refresh cron of note: " + noteId + " because it is in trash");
+      LOGGER.warn("Skip refresh cron of note: {} because it is in trash", noteId);
       return false;
     }
 
     Map<String, Object> config = note.getConfig();
     if (config == null) {
-      LOGGER.warn("Skip refresh cron of note: " + noteId + " because its config is empty.");
+      LOGGER.warn("Skip refresh cron of note: {} because its config is empty.", noteId);
       return false;
     }
 
-    if (!note.isCronSupported(zeppelinConfiguration)) {
-      LOGGER.warn("Skip refresh cron of note " + noteId + " because its cron is not enabled.");
+    if (!note.isCronSupported(zeppelinConfiguration).booleanValue()) {
+      LOGGER.warn("Skip refresh cron of note {} because its cron is not enabled.", noteId);
       return false;
     }
 
     String cronExpr = (String) note.getConfig().get("cron");
     if (cronExpr == null || cronExpr.trim().length() == 0) {
-      LOGGER.warn("Skip refresh cron of note " + noteId + " because its cron expression is empty.");
+      LOGGER.warn("Skip refresh cron of note {} because its cron expression is empty.", noteId);
       return false;
     }
 
-    JobDataMap jobDataMap =
-        new JobDataMap() {
-          {
-            put("noteId", noteId);
-            put("notebook", notebook);
-          }
-        };
+    JobDataMap jobDataMap = new JobDataMap();
+    jobDataMap.put("noteId", noteId);
+    jobDataMap.put("notebook", notebook);
+
     JobDetail newJob =
         JobBuilder.newJob(CronJob.class)
             .withIdentity(noteId, "note")
@@ -171,7 +165,7 @@ public class QuartzSchedulerService implements SchedulerService {
     }
 
     try {
-      LOGGER.info("Trigger cron for note: " + note.getName() + ", with cron expression: " + cronExpr);
+      LOGGER.info("Trigger cron for note: {}, with cron expression: {}",  note.getName(), cronExpr);
       scheduler.scheduleJob(newJob, trigger);
       return true;
     } catch (SchedulerException e) {