code: @Override
    public Date scheduleJob(JobDetail jobDetail, OperableTrigger trigger) throws SchedulerException {
  
      validateState();
  
      if (jobDetail == null) {
        throw new SchedulerException("JobDetail cannot be null");
      }
  
      if (trigger == null) {
        throw new SchedulerException("Trigger cannot be null");
      }
  
      if (jobDetail.getName() == null) {
        throw new SchedulerException("Job's key cannot be null");
      }
  
      if (jobDetail.getJobClass() == null) {
        throw new SchedulerException("Job's class cannot be null");
      }
  
      OperableTrigger trig = trigger;
  
      if (trigger.getJobName() == null) {
        trig.setJobName(jobDetail.getName());
      } else if (!trigger.getJobName().equals(jobDetail.getName())) {
        throw new SchedulerException("Trigger does not reference given job!");
      }
  
      trig.validate();
  
      Calendar cal = null;
      if (trigger.getCalendarName() != null) {
        cal = quartzSchedulerResources.getJobStore().retrieveCalendar(trigger.getCalendarName());
        if (cal == null) {
          throw new SchedulerException("Calendar not found: " + trigger.getCalendarName());
        }
      }
      Date ft = trig.computeFirstFireTime(cal);
  
      if (ft == null) {
        throw new SchedulerException(
            "Based on configured schedule, the given trigger will never fire.");
      }
  
      quartzSchedulerResources.getJobStore().storeJobAndTrigger(jobDetail, trig);
      notifySchedulerListenersJobAdded(jobDetail);
      notifySchedulerThread(trigger.getNextFireTime().getTime());
      notifySchedulerListenersScheduled(trigger);
  
      return ft;
    }
docs: Add the <code>{@link org.quartz.jobs.Job}</code> identified by the given <code>
  {@link org.quartz.jobs.JobDetail}</code> to the Scheduler, and associate the given <code>
  {@link org.quartz.triggers.Trigger}</code> with it.
  
  <p>If the given Trigger does not reference any <code>Job</code>, then it will be set to
  reference the Job passed with it into this method.
  
  @throws SchedulerException if the Job or Trigger cannot be added to the Scheduler, or there is
  an internal Scheduler error.