Add the produced {@code Job} to the given {@code Scheduler},
and associate the related {@code Trigger} with it.

Users <b>MUST NOT</b> use this method!

@param scheduler The given {@code Scheduler}
@throws Exception If any error occurs
499918
@Inject
    public void schedule( Scheduler scheduler )
        throws Exception
    {
        if ( cronExpression == null && trigger == null )
        {
            throw new ProvisionException( format( "Impossible to schedule Job '%s' without cron expression",
                                                  jobClass.getName() ) );
        }
        if ( cronExpression != null && trigger != null )
        {
          throw new ProvisionException( format( "Impossible to schedule Job '%s' with cron expression " +
                                                "and an associated Trigger at the same time", jobClass.getName() ) );
        }

        JobKey jobKey = jobKey( DEFAULT.equals( jobName ) ? jobClass.getName() : jobName, jobGroup );
        TriggerKey triggerKey = triggerKey( DEFAULT.equals( triggerName ) ? jobClass.getCanonicalName() : triggerName, triggerGroup );

        if ( updateExistingTrigger && scheduler.checkExists( triggerKey ) ) {
            scheduler.unscheduleJob( triggerKey );
        }

        scheduler.scheduleJob( newJob( jobClass )
                               .withIdentity( jobKey )
                               .requestRecovery( requestRecovery )
                               .storeDurably( storeDurably ).build(),
                               ( trigger == null ) ?
                               newTrigger()
                               .withIdentity( triggerKey )
                               .withSchedule( cronSchedule( cronExpression )
                                              .inTimeZone( timeZone ) )
                                              .withPriority( priority )
                                              .build()
                                : trigger);
    }
654292
@Inject(optional = true)
    public void addTriggerListeners(Set<TriggerListener> triggerListeners) throws SchedulerException {
        for (TriggerListener triggerListener : triggerListeners) {
            scheduler.getListenerManager().addTriggerListener(triggerListener);
        }
    }
879600
public void triggerJob (final JobKey jobKey, final JobDataMap data) throws SchedulerException
  {
    validateState ();

    final IOperableTrigger trig = (IOperableTrigger) newTrigger ().withIdentity (_newTriggerId (),
                                                                                 IScheduler.DEFAULT_GROUP)
                                                                  .forJob (jobKey)
                                                                  .build ();
    trig.computeFirstFireTime (null);
    if (data != null)
    {
      trig.setJobDataMap (data);
    }

    boolean collision = true;
    while (collision)
    {
      try
      {
        m_aResources.getJobStore ().storeTrigger (trig, false);
        collision = false;
      }
      catch (final ObjectAlreadyExistsException oaee)
      {
        trig.setKey (new TriggerKey (_newTriggerId (), IScheduler.DEFAULT_GROUP));
      }
    }

    notifySchedulerThread (trig.getNextFireTime ().getTime ());
    notifySchedulerListenersSchduled (trig);
  }
685189
@PostConstruct
  public void setupScheduler() {
    for(SchedulerTask task : tasks) {
      if(task.getDelay() > 0 && task.getInterval() > 0) {
        executor.scheduleWithFixedDelay(task.getTask(), task.getDelay(), task.getInterval(), task.getTimeUnit());
      } else if(task.isImmediate() && task.getInterval() > 0) {
        executor.scheduleWithFixedDelay(task.getTask(), 0l, task.getInterval(), task.getTimeUnit());
      } else if(task.getDelay() > 0) {
        executor.schedule(task.getTask(), task.getDelay(), task.getTimeUnit());
      } else {
        executor.execute(task.getTask());
      }
    }
  }
210143
private void scheduleOneTime(TaskScheduler scheduler) {
        scheduledFuture = scheduler.schedule(runnable, (int)delayTime, TimeUnit.MILLISECONDS);
    }
918874
@Override
    public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
        try {
            if (this.enterpriseConcurrentScheduler) {
                return new EnterpriseConcurrentTriggerScheduler().schedule(decorateTask(task, true), trigger);
            } else {
                ErrorHandler errorHandlerLocal = this.errorHandler != null ? this.errorHandler : TaskUtils
                        .getDefaultErrorHandler(true);
                return new ReschedulingRunnable(task, trigger, this.scheduledExecutor, errorHandlerLocal).schedule();
            }
        } catch (RejectedExecutionException ex) {
            throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task,
                    ex);
        }
    }
926136
private void scheduleGeneralConfiguredJobs()
      throws ConfigurationException, JobException, IOException {
    LOG.info("Scheduling configured jobs");
    for (Properties jobProps : loadGeneralJobConfigs()) {

      if (!jobProps.containsKey(ConfigurationKeys.JOB_SCHEDULE_KEY)) {
        // A job without a cron schedule is considered a one-time job
        jobProps.setProperty(ConfigurationKeys.JOB_RUN_ONCE_KEY, "true");
      }

      boolean runOnce = Boolean.valueOf(jobProps.getProperty(ConfigurationKeys.JOB_RUN_ONCE_KEY, "false"));
      scheduleJob(jobProps, runOnce ? new RunOnceJobListener() : new EmailNotificationJobListener());
      this.listener.addToJobNameMap(jobProps);
    }
  }
1250287
@Override
  public void addJob(JobDetail jobDetail) throws SchedulerException {

    validateState();

    quartzSchedulerResources.getJobStore().storeJob(jobDetail, true);
    notifySchedulerThread(0L);
    notifySchedulerListenersJobAdded(jobDetail);
  }
665895
public void scheduleAtWithInterval(final org.easybatch.core.job.Job job, final Date startTime, final int interval) throws JobSchedulerException {
        checkNotNull(job, "job");
        checkNotNull(startTime, "startTime");

        String name = job.getName();
        String jobName = JOB_NAME_PREFIX + name;
        String triggerName = TRIGGER_NAME_PREFIX + name;

        SimpleScheduleBuilder scheduleBuilder = simpleSchedule()
                .withIntervalInSeconds(interval)
                .repeatForever();

        Trigger trigger = newTrigger()
                .withIdentity(triggerName)
                .startAt(startTime)
                .withSchedule(scheduleBuilder)
                .forJob(jobName)
                .build();

        JobDetail jobDetail = getJobDetail(job, jobName);

        try {
            LOGGER.info("Scheduling job ''{}'' to start at {} and every {} second(s)", name, startTime, interval);
            scheduler.scheduleJob(jobDetail, trigger);
        } catch (SchedulerException e) {
            throw new JobSchedulerException(format("Unable to schedule job '%s'", name), e);
        }
    }
462591
@Override
	public void stopScheduler() {
		if (!config.isStopSchedulerAllowed()) {
			LOGGER.warn("not allowed to stop the scheduler");
			return;
		}
		if(LOGGER.isDebugEnabled()) LOGGER.debug("stopping scheduler factory");
		schedulerFactory.stop();
	}
1286400
public static void addJob(
      String jobName, String jobClassName, Map<String, Object> params, boolean isConcurrencyAllowed)
      throws SundialSchedulerException {

    try {
      addJob(
          jobName,
          getScheduler().getCascadingClassLoadHelper().loadClass(jobClassName),
          params,
          isConcurrencyAllowed);
    } catch (ClassNotFoundException e) {
      throw new SundialSchedulerException("ERROR ADDING JOB!!!", e);
    }
  }
1126839
@Inject(optional = true)
    public void addSchedulerListeners(Set<SchedulerListener> schedulerListeners) throws SchedulerException {
        for (SchedulerListener schedulerListener : schedulerListeners) {
            scheduler.getListenerManager().addSchedulerListener(schedulerListener);
        }
    }
675544
public synchronized boolean isJobPaused(final String jobName, final String groupName)
      throws SchedulerException {
    if (!ifJobExist(jobName, groupName)) {
      throw new SchedulerException(String.format("Job (job name %s, group name %s) doesn't "
          + "exist'", jobName, groupName));
    }
    final JobKey jobKey = new JobKey(jobName, groupName);
    final JobDetail jobDetail = this.scheduler.getJobDetail(jobKey);
    final List<? extends Trigger> triggers = this.scheduler.getTriggersOfJob(jobDetail.getKey());
    for (final Trigger trigger : triggers) {
      final TriggerState triggerState = this.scheduler.getTriggerState(trigger.getKey());
      if (TriggerState.PAUSED.equals(triggerState)) {
        return true;
      }
    }
    return false;
  }
802626
@Override
    public synchronized void destroy() {
        if (JobChangeLog.isEnabled()) {
            JobChangeLog.log("#job ...Destroying scheduler completely: jobs={} scheduler={}", jobKeyJobMap.size(), cron4jScheduler);
        }
        // not use AsyncManager here, because not frequent call, keep no dependency to core
        new Thread(() -> { // to release synchronized lock to avoid deadlock
            try {
                cron4jScheduler.stop();
            } catch (RuntimeException e) {
                final String msg = "#job Failed to stop jobs: jobs={} scheduler={}";
                if (JobChangeLog.isEnabled()) {
                    JobChangeLog.log(msg, jobKeyJobMap.size(), cron4jScheduler, e);
                } else { // just in case
                    logger.info(msg, jobKeyJobMap.size(), cron4jScheduler, e);
                }
            }
            Cron4jJobHistory.clear();
        }).start();
    }
415160
public void triggerJob (final JobKey jobKey, final JobDataMap data) throws SchedulerException
  {
    m_aSched.triggerJob (jobKey, data);
  }
845562
public void executeJob(String jobName) throws MangooSchedulerException {
        Objects.requireNonNull(this.quartzScheduler, Required.SCHEDULER.toString());
        Objects.requireNonNull(jobName, Required.JOB_NAME.toString());
        
        try {
            for (JobKey jobKey : getAllJobKeys()) {
                if (jobKey.getName().equalsIgnoreCase(jobName)) {
                    this.quartzScheduler.triggerJob(jobKey);  
                }
            }
        } catch (SchedulerException | MangooSchedulerException e) {
            throw new MangooSchedulerException(e);
        }
    }
818877
@Override
	public boolean isPaused(JobKey jobKey) throws SchedulerException {
		List<? extends Trigger> triggers = scheduler.getTriggersOfJob(jobKey);
		boolean result = true; 
		if (null != triggers && triggers.size() > 0) {
			for (Trigger trigger : triggers) {
				result = result && scheduler.getTriggerState(trigger.getKey()) == TriggerState.PAUSED;
			}
			return result;
		}
		return false;
	}