Trigger trigger = TriggerBuilder.newTrigger().withIdentity("myTrigger", "Group1").startNow().withSchedule( SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(2).repeatForever().build());
一直提示我类型不匹配什么情况啊,奇葩呀。
你写错了。buil()方法是TriggerBuilder的,你写到里面了。正确的是这样:
//创建一个trigger实例,定义job的执行过程
Trigger trigger = TriggerBuilder.newTrigger().withIdentity("myTrigger","group").startNow()
.withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(2).repeatForever())
.build();