Java 类org.quartz.Trigger.CompletedExecutionInstruction 实例源码

项目:lams    文件:JobRunShell.java   
private boolean notifyTriggerListenersComplete(JobExecutionContext jobExCtxt, CompletedExecutionInstruction instCode) {
    try {
        qs.notifyTriggerListenersComplete(jobExCtxt, instCode);

    } catch (SchedulerException se) {
        qs.notifySchedulerListenersError(
                "Unable to notify TriggerListener(s) of Job that was executed: "
                        + "(error will be ignored). trigger= "
                        + jobExCtxt.getTrigger().getKey() + " job= "
                        + jobExCtxt.getJobDetail().getKey(), se);

        return false;
    }
    if (jobExCtxt.getTrigger().getNextFireTime() == null) {
        qs.notifySchedulerListenersFinalized(jobExCtxt.getTrigger());
    }

    return true;
}
项目:lams    文件:QuartzScheduler.java   
public void notifyTriggerListenersComplete(JobExecutionContext jec,
        CompletedExecutionInstruction instCode) throws SchedulerException {
    // build a list of all trigger listeners that are to be notified...
    List<TriggerListener> triggerListeners = buildTriggerListenerList();

    // notify all trigger listeners in the list
    for(TriggerListener tl: triggerListeners) {
        try {
            if(!matchTriggerListener(tl, jec.getTrigger().getKey()))
                continue;
            tl.triggerComplete(jec.getTrigger(), jec, instCode);
        } catch (Exception e) {
            SchedulerException se = new SchedulerException(
                    "TriggerListener '" + tl.getName()
                            + "' threw exception: " + e.getMessage(), e);
            throw se;
        }
    }
}
项目:lams    文件:LoggingTriggerHistoryPlugin.java   
public void triggerComplete(Trigger trigger, JobExecutionContext context,
        CompletedExecutionInstruction triggerInstructionCode) {
    if (!getLog().isInfoEnabled()) {
        return;
    } 

    String instrCode = "UNKNOWN";
    if (triggerInstructionCode == CompletedExecutionInstruction.DELETE_TRIGGER) {
        instrCode = "DELETE TRIGGER";
    } else if (triggerInstructionCode == CompletedExecutionInstruction.NOOP) {
        instrCode = "DO NOTHING";
    } else if (triggerInstructionCode == CompletedExecutionInstruction.RE_EXECUTE_JOB) {
        instrCode = "RE-EXECUTE JOB";
    } else if (triggerInstructionCode == CompletedExecutionInstruction.SET_ALL_JOB_TRIGGERS_COMPLETE) {
        instrCode = "SET ALL OF JOB'S TRIGGERS COMPLETE";
    } else if (triggerInstructionCode == CompletedExecutionInstruction.SET_TRIGGER_COMPLETE) {
        instrCode = "SET THIS TRIGGER COMPLETE";
    }

    Object[] args = {
        trigger.getKey().getName(), trigger.getKey().getGroup(),
        trigger.getPreviousFireTime(), trigger.getNextFireTime(),
        new java.util.Date(), context.getJobDetail().getKey().getName(),
        context.getJobDetail().getKey().getGroup(),
        Integer.valueOf(context.getRefireCount()),
        triggerInstructionCode.toString(), instrCode
    };

    getLog().info(MessageFormat.format(getTriggerCompleteMessage(), args));
}
项目:nexus-public    文件:JobStoreImplTest.java   
@Test
public void jobDataOnlySavedWhenDirty() throws Exception {
  JobDetail job = JobBuilder.newJob(MyJob.class).withIdentity("testJob").build();
  OperableTrigger trigger = (OperableTrigger) TriggerBuilder.newTrigger().withIdentity("testJob").forJob(job).build();
  jobStore.storeJobAndTrigger(job, trigger);

  int baseRecordVersion = queryJobDetail("testJob").getVersion();

  // same job data after trigger fired...
  jobStore.triggersFired(Arrays.asList(trigger));
  jobStore.triggeredJobComplete(trigger, job, CompletedExecutionInstruction.NOOP);

  // ...should not save the job
  assertThat(queryJobDetail("testJob").getVersion(), is(baseRecordVersion));

  // different job data after trigger fired...
  jobStore.triggersFired(Arrays.asList(trigger));
  job.getJobDataMap().put("testKey", "testValue");
  jobStore.triggeredJobComplete(trigger, job, CompletedExecutionInstruction.NOOP);

  // ...should save the job
  assertThat(queryJobDetail("testJob").getVersion(), greaterThan(baseRecordVersion));
}
项目:lams    文件:JobStoreSupport.java   
/**
 * <p>
 * Inform the <code>JobStore</code> that the scheduler has completed the
 * firing of the given <code>Trigger</code> (and the execution its
 * associated <code>Job</code>), and that the <code>{@link org.quartz.JobDataMap}</code>
 * in the given <code>JobDetail</code> should be updated if the <code>Job</code>
 * is stateful.
 * </p>
 */
public void triggeredJobComplete(final OperableTrigger trigger,
        final JobDetail jobDetail, final CompletedExecutionInstruction triggerInstCode) {
    retryExecuteInNonManagedTXLock(
        LOCK_TRIGGER_ACCESS,
        new VoidTransactionCallback() {
            public void executeVoid(Connection conn) throws JobPersistenceException {
                triggeredJobComplete(conn, trigger, jobDetail,triggerInstCode);
            }
        });    
}
项目:lams    文件:BroadcastTriggerListener.java   
public void triggerComplete(Trigger trigger, JobExecutionContext context, CompletedExecutionInstruction triggerInstructionCode) {

        Iterator<TriggerListener> itr = listeners.iterator();
        while(itr.hasNext()) {
            TriggerListener l = itr.next();
            l.triggerComplete(trigger, context, triggerInstructionCode);
        }
    }
项目:bgp-ls    文件:FireEventTimeManager.java   
@Override
public void triggerComplete(Trigger trigger,
        JobExecutionContext context,
        CompletedExecutionInstruction triggerInstructionCode) {
    if(trigger.getKey().equals(triggerKey)) {
        firedWhen = null;
        triggerKey = null;
    }
}
项目:spring-boot-quartz-demo    文件:TriggerListner.java   
@Override
public void triggerComplete(Trigger trigger, JobExecutionContext context, CompletedExecutionInstruction triggerInstructionCode) {
    System.out.println("TriggerListner.triggerComplete()");
}
项目:lams    文件:PlainTerracottaJobStore.java   
@Override
public void triggeredJobComplete(OperableTrigger trigger, JobDetail jobDetail,
                                 CompletedExecutionInstruction triggerInstCode) {
  clusteredJobStore.triggeredJobComplete(trigger, jobDetail, triggerInstCode);
}
项目:lams    文件:TriggerListenerSupport.java   
public void triggerComplete(
    Trigger trigger,
    JobExecutionContext context,
    CompletedExecutionInstruction triggerInstructionCode) {
}
项目:lams    文件:QuartzScheduler.java   
protected void notifyJobStoreJobComplete(OperableTrigger trigger, JobDetail detail, CompletedExecutionInstruction instCode) {
    resources.getJobStore().triggeredJobComplete(trigger, detail, instCode);
}
项目:lams    文件:QuartzScheduler.java   
protected void notifyJobStoreJobVetoed(OperableTrigger trigger, JobDetail detail, CompletedExecutionInstruction instCode) {
    resources.getJobStore().triggeredJobComplete(trigger, detail, instCode);
}
项目:webscheduler    文件:SchedulerService.java   
@Override
public void triggerComplete(Trigger trigger, JobExecutionContext context,
        CompletedExecutionInstruction triggerInstructionCode) {
    ProcessLogger.debug("trigger complete:" + trigger);
}
项目:nexus-public    文件:JobStoreImpl.java   
@Override
public void triggeredJobComplete(final OperableTrigger trigger,
                                 final JobDetail jobDetail,
                                 final CompletedExecutionInstruction instruction)
{
  log.debug("Triggered job complete: trigger={}, jobDetail={}, instruction={}", trigger, jobDetail, instruction);

  executeAndPropagate(db -> {

    // back from quartz; save job-data-map if needed
    if (jobDetail.getJobDataMap().isDirty() && jobDetail.isPersistJobDataAfterExecution()) {
      JobDetailEntity jobDetailEntity = jobDetailEntityAdapter.readByKey(db, jobDetail.getKey());

      if (jobDetailEntity != null) {
        jobDetailEntity.setValue(jobDetail);
        jobDetailEntityAdapter.editEntity(db, jobDetailEntity);
      }
    }

    // unblock triggers if concurrent execution is disallowed
    if (jobDetail.isConcurrentExectionDisallowed()) {
      unblockTriggers(db, jobDetail);
      signaler.signalSchedulingChange(0L);
    }

    TriggerEntity triggerEntity = triggerEntityAdapter.readByKey(db, trigger.getKey());

    if (triggerEntity != null) {
      switch (instruction) {
        case DELETE_TRIGGER:
          if (trigger.getNextFireTime() == null) {
            // double check for possible reschedule within job execution, which would cancel the need to delete
            if (triggerEntity.getValue().getNextFireTime() == null) {
              triggerEntityAdapter.deleteEntity(db, triggerEntity);
            }
          }
          else {
            triggerEntityAdapter.deleteEntity(db, triggerEntity);
            signaler.signalSchedulingChange(0L);
          }
          break;

        case SET_TRIGGER_COMPLETE:
          triggerEntity.setState(COMPLETE);
          triggerEntityAdapter.editEntity(db, triggerEntity);
          signaler.signalSchedulingChange(0L);
          break;

        case SET_TRIGGER_ERROR:
          triggerEntity.setState(ERROR);
          triggerEntityAdapter.editEntity(db, triggerEntity);
          signaler.signalSchedulingChange(0L);
          break;

        case SET_ALL_JOB_TRIGGERS_COMPLETE:
          updateTriggerState(db, jobDetail.getKey(), COMPLETE);
          signaler.signalSchedulingChange(0L);
          break;

        case SET_ALL_JOB_TRIGGERS_ERROR:
          updateTriggerState(db, jobDetail.getKey(), ERROR);
          signaler.signalSchedulingChange(0L);
          break;
      }
    }

    return null;
  });
}
项目:example-java    文件:WakeMeUpTriggerListener.java   
@Override
public void triggerComplete(Trigger trigger, JobExecutionContext context, CompletedExecutionInstruction triggerInstructionCode) {
    System.out.println("trigger complete");
}
项目:sakai    文件:GlobalTriggerListener.java   
@Override
public void triggerComplete(Trigger trigger, JobExecutionContext context, CompletedExecutionInstruction triggerInstructionCode) {
    Date complete = Date.from(context.getFireTime().toInstant().plusMillis(context.getJobRunTime()));
    eventManager.createTriggerEvent (TriggerEvent.TRIGGER_EVENT_TYPE.COMPLETE, context.getJobDetail().getKey(), trigger.getKey(), complete, "Trigger complete", getServerId());
}
项目:sakai    文件:NavigableEventLogListener.java   
@Override
public void triggerComplete(Trigger trigger, JobExecutionContext context, CompletedExecutionInstruction triggerInstructionCode) {
    info (EVENTTYPE.TRIGGER_COMPLETED, trigger, context, null, triggerInstructionCode);        
}
项目:sce-backend    文件:MyTriggerListener.java   
@Override
public void triggerComplete(Trigger trigger, JobExecutionContext context,
        CompletedExecutionInstruction triggerInstructionCode) {
    // do something with the event

}
项目:sce-backend    文件:LoggingTriggerHistoryPluginCustom.java   
@Override
public void triggerComplete(Trigger trigger, JobExecutionContext context,
        CompletedExecutionInstruction triggerInstructionCode) {
    try {
        /*if (!getLog().isInfoEnabled()) {
         return;
         }*/
        String ipAddress = getIpAddress();
        String instrCode = "UNKNOWN";
        if (triggerInstructionCode == CompletedExecutionInstruction.DELETE_TRIGGER) {
            instrCode = "DELETE TRIGGER";
        } else if (triggerInstructionCode == CompletedExecutionInstruction.NOOP) {
            instrCode = "DO NOTHING";
        } else if (triggerInstructionCode == CompletedExecutionInstruction.RE_EXECUTE_JOB) {
            instrCode = "RE-EXECUTE JOB";
        } else if (triggerInstructionCode == CompletedExecutionInstruction.SET_ALL_JOB_TRIGGERS_COMPLETE) {
            instrCode = "SET ALL OF JOB'S TRIGGERS COMPLETE";
        } else if (triggerInstructionCode == CompletedExecutionInstruction.SET_TRIGGER_COMPLETE) {
            instrCode = "SET THIS TRIGGER COMPLETE";
        }

        Object[] args = {
            context.getFireInstanceId(),
            context.getJobDetail().getKey().getName(),
            context.getJobDetail().getKey().getGroup(),
            jobDataMapToString(context.getJobDetail().getJobDataMap()),
            new java.util.Date(),
            trigger.getKey().getName(),
            trigger.getKey().getGroup(),
            trigger.getPreviousFireTime() != null ? trigger.getPreviousFireTime() : new Date(0),
            trigger.getNextFireTime() != null ? trigger.getNextFireTime() : new Date(0),
            Integer.toString(context.getRefireCount()),
            triggerInstructionCode.toString(),
            context.getScheduler().getSchedulerInstanceId(),
            context.getScheduler().getSchedulerName(),
            ipAddress != null ? ipAddress : "",
            "COMPLETE",
            "LoggingTriggerHistoryPluginCustom",
            "INFO"
        };
        //getLog().info(MessageFormat.format(getTriggerCompleteMessage(), args));
        //log but do not update QRTZ.STATUS table with the COMPLETE status (updateStatus = false)
        logToDatabase(args, MessageFormat.format(getTriggerCompleteMessage(), args), false);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:sakai    文件:GlobalTriggerListener.java   
@Override
public void triggerComplete(Trigger trigger, JobExecutionContext context, CompletedExecutionInstruction triggerInstructionCode) {
    Date complete = Date.from(context.getFireTime().toInstant().plusMillis(context.getJobRunTime()));
    eventManager.createTriggerEvent (TriggerEvent.TRIGGER_EVENT_TYPE.COMPLETE, context.getJobDetail().getKey(), trigger.getKey(), complete, "Trigger complete", getServerId());
}
项目:sakai    文件:NavigableEventLogListener.java   
@Override
public void triggerComplete(Trigger trigger, JobExecutionContext context, CompletedExecutionInstruction triggerInstructionCode) {
    info (EVENTTYPE.TRIGGER_COMPLETED, trigger, context, null, triggerInstructionCode);        
}
项目:lams    文件:TriggerListener.java   
/**
 * <p>
 * Called by the <code>{@link Scheduler}</code> when a <code>{@link Trigger}</code>
 * has fired, it's associated <code>{@link org.quartz.JobDetail}</code>
 * has been executed, and it's <code>triggered(xx)</code> method has been
 * called.
 * </p>
 * 
 * @param trigger
 *          The <code>Trigger</code> that was fired.
 * @param context
 *          The <code>JobExecutionContext</code> that was passed to the
 *          <code>Job</code>'s<code>execute(xx)</code> method.
 * @param triggerInstructionCode
 *          the result of the call on the <code>Trigger</code>'s<code>triggered(xx)</code>
 *          method.
 */
void triggerComplete(Trigger trigger, JobExecutionContext context,
        CompletedExecutionInstruction triggerInstructionCode);
项目:lams    文件:JobStore.java   
/**
 * Inform the <code>JobStore</code> that the scheduler has completed the
 * firing of the given <code>Trigger</code> (and the execution of its
 * associated <code>Job</code> completed, threw an exception, or was vetoed),
 * and that the <code>{@link org.quartz.JobDataMap}</code>
 * in the given <code>JobDetail</code> should be updated if the <code>Job</code>
 * is stateful.
 */
void triggeredJobComplete(OperableTrigger trigger, JobDetail jobDetail, CompletedExecutionInstruction triggerInstCode);
项目:qb-archetype    文件:TriggerEventListener.java   
public void triggerComplete(Trigger trigger, JobExecutionContext context, CompletedExecutionInstruction triggerInstructionCode) {

    }
项目:javasec    文件:TriggerEventListener.java   
public void triggerComplete(Trigger trigger, JobExecutionContext context, CompletedExecutionInstruction triggerInstructionCode) {

    }