@Test public void testSchedule() throws Exception{ System.out.println("schedule"); String jobId = "testSchedule_jobId"; CronExpression cronTrigger = new CronExpression("1/1 * * ? * *"); // ZoneId zoneId = ZoneId.of("UTC"); final ConcurrentLinkedDeque<Integer> invocations = new ConcurrentLinkedDeque<>(); ScheduledJobExecutor jobExec = new ScheduledJobExecutor(){ @Override public void execute(Map<String, Object> parameters) { log.info("Test Task executed"); invocations.add(1); } }; try{ instance.schedule(jobId, cronTrigger, jobExec); Thread.sleep(2000l); assertTrue( invocations.size() > 0 ); }finally{ instance.unSchedule(jobId); } }
private VmSchedule checkAndSaveSchedule(final VmScheduleVo schedule, final VmSchedule entity) { // Check the subscription is visible final Subscription subscription = subscriptionResource.checkVisibleSubscription(schedule.getSubscription()); if (schedule.getCron().split(" ").length == 6) { // Add the missing "seconds" part schedule.setCron(schedule.getCron() + " *"); } // Check expressions first if (!CronExpression.isValidExpression(schedule.getCron())) { throw new ValidationJsonException("cron", "vm-cron"); } // Every second is not accepted if (schedule.getCron().startsWith("* ")) { throw new ValidationJsonException("cron", "vm-cron-second"); } entity.setSubscription(subscription); entity.setOperation(schedule.getOperation()); entity.setCron(schedule.getCron()); // Persist the new schedules for each provided CRON vmScheduleRepository.saveAndFlush(entity); return entity; }
/** * 注意:@RequestBody需要把所有请求参数作为json解析,因此,不能包含key=value这样的写法在请求url中,所有的请求参数都是一个json * */ @RequiresPermissions("job:index") @ResponseBody @RequestMapping(value = "job", method = RequestMethod.POST) public ResponseDTO add(@RequestBody JobAddAO jobAddAO) { try { //cron表达式合法性校验 CronExpression exp = new CronExpression(jobAddAO.getCron()); JobDetailDO jobDetailDO = new JobDetailDO(); BeanUtils.copyProperties(jobAddAO, jobDetailDO); jobDetailService.addJobDetail(jobDetailDO); } catch (ParseException e) { e.printStackTrace(); return new ResponseDTO(0, "failed", null); } return new ResponseDTO(1, "success", null); }
@RequestMapping("withoutAuth/validateCron.html") @ResponseBody public Object validateCronExpression(String cronExpression){ try { boolean result = CronExpression.isValidExpression(cronExpression); if(result) { return true; }else { return false; } }catch(Exception e) { throw new AjaxException(e); } }
public static Instant nextValidTimeFromCron(String patterns) { String[] array = patterns.split("\\|"); Instant next = Instant.MAX; for (String pattern : array) { if (pattern.split(" ").length == 5) { pattern = "0 " + pattern; } try { List<String> parts = Arrays.asList(pattern.split(" ")); if (parts.get(3).equals("*")) { parts.set(3, "?"); } CronExpression cronExpression = new CronExpression(parts.stream().collect(Collectors.joining(" "))); Instant nextPart = cronExpression.getNextValidTimeAfter(Date.from(Instant.now())).toInstant(); next = nextPart.isBefore(next) ? nextPart : next; } catch (ParseException e) { log.warn("Could not parse cron expression: {}", e.toString()); } } return next; }
@Override public void schedule(String jobName, CronExpression cronExpression) { try { if(jobDetail != null){ jobDetail.setName(jobName); jobDetail.setGroup(JOB_GROUP_NAME); CronTrigger cronTrigger = new CronTrigger(jobName, TRIGGER_GROUP_NAME); cronTrigger.setCronExpression(cronExpression); scheduler.scheduleJob(jobDetail,cronTrigger); if(!scheduler.isShutdown()) scheduler.start(); }else{ log.error("定时任务 "+jobName+" jobDetail对象为空"); //System.out.println("定时任务 "+jobName+" jobDetail对象为空"); } // scheduler.rescheduleJob(name, Scheduler.DEFAULT_GROUP, cronTrigger); } catch (SchedulerException e) { log.error(e); throw new RuntimeException(e); } }
/** * Register cron job REST API * @param message - JSON with cron expressions. * @return JSON with status.OK * @throws IOException, IllegalArgumentException */ @POST @Path("cron/{notebookId}") public Response registerCronJob(@PathParam("notebookId") String notebookId, String message) throws IOException, IllegalArgumentException { LOG.info("Register cron job note={} request cron msg={}", notebookId, message); CronRequest request = gson.fromJson(message, CronRequest.class); Note note = notebook.getNote(notebookId); if (note == null) { return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); } if (!CronExpression.isValidExpression(request.getCronString())) { return new JsonResponse<>(Status.BAD_REQUEST, "wrong cron expressions.").build(); } Map<String, Object> config = note.getConfig(); config.put("cron", request.getCronString()); note.setConfig(config); notebook.refreshCron(note.id()); return new JsonResponse<>(Status.OK).build(); }
/** * Cron schedule support using {@link CronExpression} validation. */ @Override public Cron cron(final Date startAt, final String cronExpression) { checkNotNull(startAt); checkArgument(!Strings2.isBlank(cronExpression), "Empty Cron expression"); // checking with regular-expression checkArgument(CRON_PATTERN.matcher(cronExpression).matches(), "Invalid Cron expression: %s", cronExpression); // and implementation for better coverage, as the following misses some invalid syntax try { CronExpression.validateExpression(cronExpression); } catch (ParseException e) { throw new IllegalArgumentException("Invalid Cron expression: '" + cronExpression + "': " + e.getMessage(), e); } return new Cron(startAt, cronExpression); }
public static void validateCronExpression(String cronExpression) { try { if (cronExpression == null || cronExpression.equals("")) { throw new IllegalArgumentException(String.format("Cron expression cannot be null or empty : %s", cronExpression)); } StringTokenizer tokenizer = new StringTokenizer(cronExpression, " \t", false); int tokens = tokenizer.countTokens(); String beginningToken = tokenizer.nextToken().trim(); if ("*".equals(beginningToken)) { // For all practical purposes and for ALL clients of this library, this is true! throw new IllegalArgumentException( String.format("Cron expression cannot have '*' in the SECONDS (first) position : %s", cronExpression) ); } if (tokens > 7) { throw new IllegalArgumentException( String.format("Cron expression cannot have more than 7 fields : %s", cronExpression) ); } CronExpression.validateExpression(cronExpression); } catch (ParseException e) { throw new IllegalArgumentException(e.getMessage()); } }
@Override public void validate(Object object, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "task.groupName", "group.empty"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "task.name", "name.empty"); Task task = ((TaskDTO) object).getTask(); if (!StringUtils.isEmpty(task.getTimerSchedule())) { // if there is a timer schedule, check it is valid for quartz cron trigger try { new CronExpression(task.getTimerSchedule()); } catch (ParseException e) { errors.rejectValue("task.timerSchedule", "timer.schedule.invalid", e.getMessage()); } } if (task.getGroupName() != null && Constants.GROUP_NAME_ALL.equals(task.getGroupName().trim())) { errors.rejectValue("task.groupName", "group.illegal", Constants.GROUP_NAME_ALL + " not allowed as group name"); } }
/** * Register cron job REST API * * @param message - JSON with cron expressions. * @return JSON with status.OK * @throws IOException, IllegalArgumentException */ @POST @Path("cron/{noteId}") @ZeppelinApi public Response registerCronJob(@PathParam("noteId") String noteId, String message) throws IOException, IllegalArgumentException { LOG.info("Register cron job note={} request cron msg={}", noteId, message); CronRequest request = CronRequest.fromJson(message); Note note = notebook.getNote(noteId); checkIfNoteIsNotNull(note); checkIfUserCanRun(noteId, "Insufficient privileges you cannot set a cron job for this note"); if (!CronExpression.isValidExpression(request.getCronString())) { return new JsonResponse<>(Status.BAD_REQUEST, "wrong cron expressions.").build(); } Map<String, Object> config = note.getConfig(); config.put("cron", request.getCronString()); note.setConfig(config); notebook.refreshCron(note.getId()); return new JsonResponse<>(Status.OK).build(); }
/** * Register cron job REST API * * @param message - JSON with cron expressions. * @return JSON with status.OK * @throws IOException, IllegalArgumentException */ @POST @Path("cron/{noteId}") public Response registerCronJob(@PathParam("noteId") String noteId, String message) throws IOException, IllegalArgumentException { LOG.info("Register cron job note={} request cron msg={}", noteId, message); CronRequest request = CronRequest.fromJson(message); Note note = notebook.getNote(noteId); checkIfNoteIsNotNull(note); checkIfUserCanWrite(noteId, "Insufficient privileges you cannot set a cron job for this note"); if (!CronExpression.isValidExpression(request.getCronString())) { return new JsonResponse<>(Status.BAD_REQUEST, "wrong cron expressions.").build(); } Map<String, Object> config = note.getConfig(); config.put("cron", request.getCronString()); note.setConfig(config); notebook.refreshCron(note.getId()); return new JsonResponse<>(Status.OK).build(); }
public AnomalyDetectionFunctionCronDefinition(AnomalyDetectionFunction childFunc, String cronString) throws IllegalFunctionException { super(childFunc); /* * Use local timezone of the system. */ evalTimeZone = TimeZone.getDefault(); try { cronExpression = new CronExpression(cronString); cronExpression.setTimeZone(evalTimeZone); } catch (ParseException e) { throw new IllegalFunctionException("Invalid cron definition for rule"); } }
/** * Checks if the given cron expression interval is less or equals to a certain minimum. * * @param cronExpression the cron expression to check */ public static boolean isCronIntervalLessThanMinimum(String cronExpression) { try { // If input is empty or invalid simply return false as default if (StringUtils.isBlank(cronExpression) || !isValid(cronExpression)) { return false; } CronExpression cron = new CronExpression(cronExpression); final Date firstExecution = cron.getNextValidTimeAfter(new Date(System.currentTimeMillis())); final Date secondExecution = cron.getNextValidTimeAfter(firstExecution); Minutes intervalMinutes = Minutes.minutesBetween(new DateTime(firstExecution), new DateTime(secondExecution)); return !intervalMinutes.isGreaterThan(MINIMUM_ALLOWED_MINUTES); } catch (ParseException e) { throw new IllegalArgumentException(e.getMessage()); } }
/** * Retrieves the next execution time based on the schedule and * the supplied date. * @param after The date to get the next invocation after. * @return The next execution time. */ public Date getNextExecutionDate(Date after) { try { CronExpression expression = new CronExpression(this.getCronPattern()); Date next = expression.getNextValidTimeAfter(DateUtils.latestDate(after, new Date())); if(next == null) { return null; } else if(endDate != null && next.after(endDate)) { return null; } else { return next; } } catch(ParseException ex) { System.out.println(" Encountered ParseException for cron expression: " + this.getCronPattern() + " in schedule: " + this.getOid()); return null; } }
@Override public void setFetchCron(String cronString) { if (StringUtils.isBlank(cronString)) { fetchCron = ""; eventRelay.sendEventMessage(new MotechEvent(Constants.RESCHEDULE_FETCH_JOB)); return; } if (StringUtils.equals(fetchCron, cronString)) { return; } try { CronExpression.validateExpression(cronString); } catch (ParseException ex) { throw new AtomClientConfigurationException(String.format("Cron expression %s is invalid: %s", cronString, ex.getMessage()), ex); } fetchCron = cronString; eventRelay.sendEventMessage(new MotechEvent(Constants.RESCHEDULE_FETCH_JOB)); }
private void oneTimeDate(List<OLEBatchProcessScheduleBo> oleBatchProcessScheduleBoList) { try { for (OLEBatchProcessScheduleBo oleBatchProcessScheduleBo : oleBatchProcessScheduleBoList) { CronExpression exp = new CronExpression(oleBatchProcessScheduleBo.getCronExpression()); Date date = exp.getNextValidTimeAfter(new Date()); if (date != null) { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); Timestamp nextRunTime = new Timestamp(date.getTime()); oleBatchProcessScheduleBo.setNextRunTime(nextRunTime); } } } catch (ParseException e) { LOG.error("Error while validating cron exp::" + oleBatchProcessScheduleBoList.get(0).getCronExpression(), e); } }
/** * method initializes triggers for the given jobName - Job name here is the schedule id * the name will always be suffixed with "BATCH_JOB_" * * @param jobName * @param cronExpression */ public void initializeTriggersForModule(String jobName, String cronExpression) throws Exception { try { CronExpression exp = new CronExpression(cronExpression); Date date = exp.getNextValidTimeAfter(new Date()); if (date == null) { throw new RuntimeException("given cron expression already past its valid time::" + cronExpression); } else { LOG.info("Next valid run time is:: " + date.toString() + " for the schedule job :: " + jobName); addTrigger(getCronTriggerBean(jobName, cronExpression)); } } catch (Exception e) { LOG.info("given cron expression already past its valid time::" + cronExpression, e); throw e; } }
@Override public void preStart() throws Exception { jobCreator = getContext().actorOf(Creator.props(jobManager, database, serviceManager), "creator"); getContext().actorOf( Initiator.props() .add(harvester, "harvester", new GetHarvestJobs()) .add(loader, "import", new GetImportJobs()) .add(loader, "remove", new GetRemoveJobs()) .add(provisioningManager, "service", new GetServiceJobs()) .create(jobManager, jobCreator), "initiator"); createJobsIntervals = new HashMap<>(); createJobsIntervals.put(new CreateHarvestJobs(), Either.right(new CronExpression(ON_THE_HOUR))); createJobsIntervals.put(new CreateImportJobs(), Either.left(Duration.apply(10, TimeUnit.SECONDS))); createJobsIntervals.keySet().stream() .forEach(msg -> getSelf().tell(msg, getSelf())); f = new FutureUtils(getContext()); }
/** * update alert config's cron and activation by id * @param id alert config id * @param cron cron expression for alert * @param isActive activate or not * @return Response * @throws Exception */ @PUT @Path("/alert/{id}") public Response updateAlertConfig(@NotNull @PathParam("id") Long id, @QueryParam("cron") String cron, @QueryParam("isActive") Boolean isActive) throws Exception { AlertConfigDTO alert = alertDAO.findById(id); if (alert == null) { throw new IllegalStateException("Alert Config with id " + id + " does not exist"); } if (isActive != null) { alert.setActive(isActive); } if (StringUtils.isNotEmpty(cron)) { // validate cron if (!CronExpression.isValidExpression(cron)) { throw new IllegalArgumentException("Invalid cron expression for cron : " + cron); } alert.setCronExpression(cron); } alertDAO.update(alert); return Response.ok(id).build(); }
/** * update alert config's holiday cron and activation by id * if this cron is not null then holiday mode is activate * @param id id of the config * @param cron holiday cron expression * @return Response * @throws Exception */ @PUT @Path("/alert/{id}/holiday-mode") public Response updateAlertConfigHolidayCron(@NotNull @PathParam("id") Long id, @QueryParam("cron") String cron) throws Exception { AlertConfigDTO alert = alertDAO.findById(id); if (alert == null) { throw new IllegalStateException("Alert Config with id " + id + " does not exist"); } if (StringUtils.isNotEmpty(cron)) { // validate cron if (!CronExpression.isValidExpression(cron)) { throw new IllegalArgumentException("Invalid cron expression for cron : " + cron); } // as long as there is an valid holiday cron expression within the class // the holiday model is activate alert.setHolidayCronExpression(cron); } else { alert.setHolidayCronExpression(null); // equivalent to deactivate holiday } alertDAO.update(alert); return Response.ok(id).build(); }
/** * Returns the start time of the first detection job for the current backfill. The start time is determined in the * following: * 1. If there exists any previously left detection job, then start backfill from that job. * 1a. if that job is finished, then start a job next to it. * 1b. if that job is unfinished, then restart that job. * 2. If there exists no previous left job, then start the job from the beginning. * * @param cronExpression the cron expression that is used to calculate the alignment of start time. * @return the start time for the first detection job of this backfilling. */ private DateTime computeResumeStartTime(long functionId, CronExpression cronExpression, DateTime backfillStartTime, DateTime backfillEndTime) { DateTime currentStart; JobDTO previousJob = getPreviousJob(functionId, backfillStartTime.getMillis(), backfillEndTime.getMillis()); if (previousJob != null) { long previousStartTime = previousJob.getWindowStartTime(); cleanUpJob(previousJob); if (previousJob.getStatus().equals(JobStatus.COMPLETED)) { // Schedule a job after previous job currentStart = new DateTime(cronExpression.getNextValidTimeAfter(new Date(previousStartTime))); } else { // Reschedule the previous incomplete job currentStart = new DateTime(previousStartTime); } LOG.info("Backfill starting from {} for function {} because a previous unfinished job found.", currentStart, functionId); } else { // Schedule a job starting from the beginning currentStart = backfillStartTime; } return currentStart; }
@Test public void testIsScheduled() throws Exception{ System.out.println("isScheduled"); String jobId = "testSchedule_jobId"; CronExpression cronExpression = new CronExpression("1/1 * * ? * *"); ZoneId zoneId = ZoneId.of("UTC"); final ConcurrentLinkedDeque<Integer> invocations = new ConcurrentLinkedDeque<>(); ScheduledJobExecutor jobExec = parameters -> log.info("Test Task executed"); try{ assertFalse(instance.isScheduled(jobId)); instance.schedule(jobId, cronExpression, jobExec); assertTrue(instance.isScheduled(jobId)); }finally{ instance.unSchedule(jobId); } }
/** * 校验cron表达式 * @param unexpected * @param message */ public static void isCronExpression(String unexpected, String message) { boolean validExpression = CronExpression.isValidExpression(unexpected); if (!validExpression) { throw new IllegalArgumentException(message); } }
private JSONResult validateCronExpression(String cronExpression) { try { Assert.notEmpty(cronExpression, "cronExpression can not be empty"); Map<String, Object> result = new LinkedHashMap<String, Object>(); result.put("result", CronExpression.isValidExpression(cronExpression)); return JSONResult.build(JSONResult.RESULT_CODE_SUCCESS, result); } catch (Exception e) { e.printStackTrace(); return JSONResult.build(JSONResult.RESULT_CODE_ERROR, e.getMessage()); } }
/** * @Title: validataQuartzRule * @Description: 验证quartz表达式格式是否正确 * @param quartzRule * @return boolean 返回类型 */ public static boolean validataQuartzRule(String quartzRule){ if(null==quartzRule){ return false; } try { new CronExpression(quartzRule); } catch (ParseException e) { return false; } return true; }
@RequestMapping(value = "exp.do",method= RequestMethod.POST) @ResponseBody public boolean validateCronExp(Integer cronType, String cronExp) { boolean pass = false; if (cronType == 0) pass = SchedulingPattern.validate(cronExp); if (cronType == 1) pass = CronExpression.isValidExpression(cronExp); return pass; }
/** Constructor. */ public CronSchedule (String cron_string) throws ParseException { Objects.requireNonNull (cron_string); this.cronString = cron_string; this.cronExpression = new CronExpression (cron_string); this.cronExpression.setTimeZone (TimeZone.getTimeZone ("UTC")); }
/** * Makes a Pending status. * @param ce cronExpression scheduling the synchonizer * @return Pending. */ public static SynchronizerStatus makePendingStatus (CronExpression ce) { Date now = new Date (); return new SynchronizerStatus (Status.PENDING, now, "Next activation: " + ce.getNextValidTimeAfter (now).toString ()); }
public static Instant nextValidTimeFromCron(List<String> patterns) { Instant next = Instant.MAX; for (String pattern : patterns) { try { CronExpression cronExpression = new CronExpression(pattern); Instant nextPart = cronExpression.getNextValidTimeAfter(Date.from(Instant.now())).toInstant(); next = nextPart.isBefore(next) ? nextPart : next; } catch (ParseException e) { log.warn("Could not parse cron expression: {}", e.toString()); } } return next; }
@Override protected void getServiceResult(HttpServletRequest request, Document document) throws Exception { if (request != null) { AbstractSchedule as = Engine.theApp.schedulerManager.getSchedulerXML().getSchedule(request.getParameter("name")); Element rootElement = document.getDocumentElement(); Element cronsElement = document.createElement("crons"); // Compute nextTime only if not type of ScheduleRunNow (info = RunNow) if (!(as instanceof ScheduleRunNow)) { int iteration = Integer.parseInt(request.getParameter("iteration")); String cronExpression = request.getParameter("input"); cronExpression = cronExpression.replaceFirst("(?:.*)\\[(.*)\\]", "$1"); long start = new Date().getTime(); boolean bContinue = true; while (iteration-- > 0 && bContinue) { Date nextTime; String nDate; try { CronExpression exp = new CronExpression(cronExpression); nextTime = exp.getNextValidTimeAfter(new Date(start)); start = nextTime.getTime() + 1; nDate = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new Date(start)); addNextTimeToCronsElement(document, cronsElement, nDate); } catch (Exception e) { addElementToCronsElement(document, cronsElement, "error", e.getMessage()); nDate = ""; bContinue = false; } } } else { addNextTimeToCronsElement(document, cronsElement, "n/a"); } rootElement.appendChild(cronsElement); } }
/** * Sets the cron expression for the calendar to a new value * * @param expression the new cron expression */ public void setCronExpression(CronExpression expression) { if (expression == null) { throw new IllegalArgumentException("expression cannot be null"); } this.cronExpression = expression; }
@Override public Object clone() { CronTriggerImpl copy = (CronTriggerImpl) super.clone(); if (cronEx != null) { copy.setCronExpression(new CronExpression(cronEx)); } return copy; }
@ResponseBody @RequestMapping(value = "job", method = RequestMethod.PUT) public ResponseDTO update(@RequestBody JobUpdateAO ao) { //cron表达式合法性校验 try { CronExpression exp = new CronExpression(ao.getNewCron()); jobDetailService.updateJobDetail(ao.getId(), ao.getNewCron()); } catch (ParseException e) { e.printStackTrace(); return new ResponseDTO(0, "failed", null); } logger.info("请求参数:{}", ao); return new ResponseDTO(1, "", null); }
@Override public boolean isValid(ConstraintValidatorContext context) { boolean hasErrors = false; if (schedule != null) { try { new CronExpression(schedule); } catch (ParseException e) { context.buildConstraintViolationWithTemplate(e.getMessage()) .addPropertyNode("schedule").addConstraintViolation(); hasErrors = true; } } return !hasErrors; }
@Override void onHandle(Node node, String value) { String[] crons = value.split(" "); if (crons.length != 5) { throw new IllegalParameterException("Illegal crontab format"); } String seconds = "0"; String minute = crons[0]; String hours = crons[1]; String dayOfMonth = crons[2]; String month = crons[3]; String dayOfWeek = crons[4]; // quartz not support for specifying both a day-of-week and a day-of-month if (!Objects.equals(dayOfMonth, NO_SPECIFIC_VALUE) && !Objects.equals(dayOfWeek, NO_SPECIFIC_VALUE)) { dayOfMonth = NO_SPECIFIC_VALUE; } String crontabValue = seconds + " " + minute + " " + hours + " " + dayOfMonth + " " + month + " " + dayOfWeek; try { // fill seconds to crontab value node.putEnv(env(), crontabValue); new CronExpression(crontabValue); // setup new value and crontab task nodeCrontabService.set(node); } catch (ParseException e) { throw new IllegalParameterException(e.getMessage()); } finally { // reset value to original node.putEnv(env(), value); } }
@DataProvider public Collection<CronDate> parseCronExpression(String cron) throws Exception{ CronExpression expr=new CronExpression(cron); List<CronDate> dates=new ArrayList<CronDate>(); Date startDate=new Date(); for(int i=0;i<50;i++){ startDate=expr.getNextValidTimeAfter(startDate); CronDate cd=new CronDate(); cd.setDate(startDate); dates.add(cd); } return dates; }
/** * Executes command {@code UPDATE}. * @param settings the settings to update. * @throws BotExecutionException when invalid update. */ private static void update(Map<String,String> settings) throws BotExecutionException { LOGGER.info("Updating settings {}...", settings); for (String property : settings.keySet()) { switch (property) { case ControllerProperties.PROPERTY_SLEEP: final String sleep = settings.get(ControllerProperties.PROPERTY_SLEEP); try { if (sleep == null) { POOL.removeSleepMode(); } else { POOL.setSleepMode(new CronExpression(sleep)); } } catch (ParseException | SchedulerException exc) { throw new BotExecutionException("Cannot update [sleep]. %s", exc.getMessage()); } AppConfigurationService.getConfigurations().setSleep(sleep); break; case ControllerProperties.USER_AGENT: if (CONTROLLER.getAuthentication() == null) { CONTROLLER.setAuthentication(new HashMap<>()); } CONTROLLER.getAuthentication().put("User-Agent", settings.get(property)); break; default: LOGGER.warn("Cannot update [{}], skipping. This version does not provide the update procedure.", property); break; } } LOGGER.info("Settings updated"); }