public void initialize(String cron, List<String> domainIds) {
    try {
      this.domainIds = domainIds;

      Scheduler scheduler = SchedulerProvider.getScheduler();
      scheduler.unscheduleJob(ADMINSYNCHRODOMAIN_JOB_NAME);
      JobTrigger trigger = JobTrigger.triggerAt(cron);
      scheduler.scheduleJob(ADMINSYNCHRODOMAIN_JOB_NAME, trigger, this);
    } catch (Exception e) {
      SilverLogger.getLogger(this).error(e.getMessage(), e);
    }
  }
 @Override
 public void init() throws Exception {
   try {
     Scheduler scheduler = SchedulerProvider.getScheduler();
     if (scheduler.isJobScheduled(MAILING_LIST_JOB_NAME)) {
       scheduler.unscheduleJob(MAILING_LIST_JOB_NAME);
     }
     if (hasToCheckForNewMails()) {
       SilverLogger.getLogger(this)
           .info("Check mails from mailing lists every " + getFrequency() + " minutes");
       MessageChecker checker = getMessageChecker();
       JobTrigger trigger = JobTrigger.triggerEvery(getFrequency(), TimeUnit.MINUTE);
       scheduler.scheduleJob(MAILING_LIST_JOB_NAME, trigger, checker);
       List<MailingList> mailingLists = getMailingListService().listAllMailingLists();
       for (MailingList list : mailingLists) {
         MailingListComponent component = new MailingListComponent(list.getComponentId());
         checker.addMessageListener(component);
       }
     }
   } catch (SchedulerException ex) {
     SilverLogger.getLogger(this).error(ex.getMessage(), ex);
   }
 }
  @Override
  public void init() throws Exception {

    // Job instance
    final TemporaryDataCleanerJob temporaryDataCleanerJob = new TemporaryDataCleanerJob();

    // Cleaning temporary data at start if requested
    startTask =
        ManagedThreadPool.invoke(
                () -> {
                  temporaryDataCleanerJob.clean(
                      TemporaryDataManagementSetting
                          .getTimeAfterThatFilesMustBeDeletedAtServerStart());
                })
            .iterator()
            .next();

    // Setting CRON
    final String cron = TemporaryDataManagementSetting.getJobCron();
    scheduler.unscheduleJob(JOB_NAME);
    if (StringUtil.isDefined(cron)) {
      scheduler.scheduleJob(temporaryDataCleanerJob, JobTrigger.triggerAt(cron));
    }
  }