Quartz研究报告2

4.           更多job介绍

l         带参数的job

首先在运行前传入参数:

JobDetail类的getJobDataMap()方法,返回值JobDataMap,可以在此基础上进行Map操作。

例如:

job.getJobDataMap().put("love", "I love you very much!");

其次在job中获得参数。

execute方法中,传入上下文context,如下所示:

public void execute(JobExecutionContext context)

再获得JobDataMap,从Map中获得所需数据,示例代码如下:

String jobName = context.getJobDetail().getName();

JobDataMap dataMap = context.getJobDetail().getJobDataMap();

String strData = dataMap.getString("love");

l         StatefulJob

You 'mark' a Job as stateful by having it implement the StatefulJob interface, rather than the Job interface.

5.           更多有关Trigger的知识

Calendars

用来排除一些日期,下面为它的声明。

package org.quartz;
  public interface Calendar {
    public boolean isTimeIncluded(long timeStamp);
    public long getNextIncludedTime(long timeStamp);

  }

 

 

你可能感兴趣的:(quartz)