Merge branch 'master' of https://github.com/xuxueli/xxl-job.git
commit
ff0b4533bc
@ -0,0 +1,24 @@
|
||||
package com.xxl.job.service.job.impl;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
|
||||
import com.xxl.job.service.job.LocalNomalJobBean;
|
||||
|
||||
@DisallowConcurrentExecution // 串行;线程数要多配置几个,否则不生效;
|
||||
public class DemoConcurrentJobBean extends LocalNomalJobBean {
|
||||
|
||||
@Override
|
||||
public Object handle(String... param) {
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.xxl.job.service.job.impl;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.xxl.job.service.job.LocalNomalJobBean;
|
||||
|
||||
public class DemoNomalJobBean extends LocalNomalJobBean {
|
||||
private static Logger Logger = LoggerFactory.getLogger(DemoNomalJobBean.class);
|
||||
|
||||
@Override
|
||||
public Object handle(String... param) {
|
||||
Logger.info("DemoNomalJobBean run :" + param);
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue