xueli.xue 9 years ago
commit ff0b4533bc
  1. 24
      xxl-job-admin/src/main/java/com/xxl/job/service/job/impl/DemoConcurrentJobBean.java
  2. 26
      xxl-job-admin/src/main/java/com/xxl/job/service/job/impl/DemoNomalJobBean.java

@ -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…
Cancel
Save