فهرست منبع

Merge branch 'master' of https://github.com/xuxueli/xxl-job.git

xueli.xue 9 سال پیش
والد
کامیت
ff0b4533bc

+ 24 - 0
xxl-job-admin/src/main/java/com/xxl/job/service/job/impl/DemoConcurrentJobBean.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;
+	}
+
+}

+ 26 - 0
xxl-job-admin/src/main/java/com/xxl/job/service/job/impl/DemoNomalJobBean.java

@@ -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;
+	}
+
+}