In the osworkflow, Trigger Function is accomplished by Quartz, we look LocalWorkflowJob.java implementation code: public void execute (JobExecutionContext jobExecutionContext) throws JobExecutionException {// JobDataMap is placed before the start of the schedule JobDataMap data = jobExecutionContext.getJobDetail () .GetjobdataMap (); // entryid is a workflow real number No. Long id = data.getlong ("entryid"); // In the process definition of Trigger ID INT TRIGGERID = Data.Getint ("TriggerID"); String username = data.getString ( "username"); Workflow wf = new BasicWorkflow (username); try {// perform the actual trigger wf.executeTriggerFunction (id, triggerId);} catch (WorkflowException e) {// this cast is a fairly horrible hack, but it's more due to the fact that quartz is stupid enough to have wrapped exceptions // wrap Exception, instead of Throwable. throw new JobExecutionException ( "Error Executing local job", (e.getRootCause ()! = null (Exception) E.GETROOTCAUSE (): E, TRUE);}}
In fact, we can use Quartz to implement more features in our own workflow engine or system. For example, we have a need to limit the time limit for the process or activity, to the task executor 10 minutes before this time limit Alarm, then we can implement this: Start Scheduler when the server is started, then every 1 minute, the process instance in the computing engine is restless, this time does not require persistence, directly recorded in memory, can be made by the engine Partial read.