返回

提问 添加收藏

项目启动,无法实例化SpringJobScheduler

本页包含1张图片,默认未加载,显示所有图片

nanguagirl1 发布于 2017年06月19日 (共有1个回帖)

 
public class JobDemo implements SimpleJob {


    private final static Logger logger = Logger.getLogger(JobDemo.class);

    public void execute(ShardingContext shardingContext) {

        /*int a = shardingContext.getShardingItem();
        String para = shardingContext.getShardingParameter();
        String jobpara = shardingContext.getJobParameter();
        String jobname = shardingContext.getJobName();*/
        logger.info("测试定时任务");

    }
}
<!--configure registry center -->
<reg:zookeeper id="regCenter" server-lists="localhost:2181" namespace="dd-job-test" base-sleep-time-milliseconds="1000" max-sleep-time-milliseconds="3000" max-retries="3" />

<!--configure job -->
<job:simple id="JobDemo" class="com.sjzl.york.task.JobDemo"
         registry-center-ref="regCenter" cron="0/1 * * * * ?"
         sharding-total-count="1"
         sharding-item-parameters="0=A" overwrite="true"/>

点击加载图片

 

 

Elastic-Job
文明上网,理性发言
客户端 Android iPhone WP7