This is an automated email from the ASF dual-hosted git repository. xiangfu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push: new f7af798 Handle scheduler calls with proper response when it's disabled. (#6474) f7af798 is described below commit f7af79888c2bfc65275324b19edd700c1d8d1ff8 Author: Xiang Fu <fx19880...@gmail.com> AuthorDate: Fri Jan 22 01:27:43 2021 -0800 Handle scheduler calls with proper response when it's disabled. (#6474) --- .../controller/api/resources/PinotTaskRestletResource.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTaskRestletResource.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTaskRestletResource.java index 1555fa9..b149a6b 100644 --- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTaskRestletResource.java +++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTaskRestletResource.java @@ -186,6 +186,9 @@ public class PinotTaskRestletResource { public Map<String, Object> getCronSchedulerInformation() throws SchedulerException { Scheduler scheduler = _pinotTaskManager.getScheduler(); + if (scheduler == null) { + throw new NotFoundException("Task scheduler is disabled"); + } SchedulerMetaData metaData = scheduler.getMetaData(); Map<String, Object> schedulerMetaData = new HashMap<>(); schedulerMetaData.put("Version", metaData.getVersion()); @@ -219,8 +222,11 @@ public class PinotTaskRestletResource { @ApiOperation("Fetch cron scheduler job keys") public List<JobKey> getCronSchedulerJobKeys() throws SchedulerException { - List<JobKey> jobKeys = new ArrayList<>(); Scheduler scheduler = _pinotTaskManager.getScheduler(); + if (scheduler == null) { + throw new NotFoundException("Task scheduler is disabled"); + } + List<JobKey> jobKeys = new ArrayList<>(); for (String group : scheduler.getTriggerGroupNames()) { jobKeys.addAll(scheduler.getJobKeys(GroupMatcher.groupEquals(group))); } @@ -235,6 +241,9 @@ public class PinotTaskRestletResource { @ApiParam(value = "Task type") @QueryParam("taskType") String taskType) throws SchedulerException { Scheduler scheduler = _pinotTaskManager.getScheduler(); + if (scheduler == null) { + throw new NotFoundException("Task scheduler is disabled"); + } JobKey jobKey = JobKey.jobKey(tableName, taskType); if (!scheduler.checkExists(jobKey)) { throw new NotFoundException( --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org