|
@@ -1,20 +1,18 @@
|
1
|
1
|
package com.xxl.job.core.handler;
|
2
|
2
|
|
|
3
|
+import com.xxl.job.core.handler.HandlerRepository.HandlerParamEnum;
|
|
4
|
+import com.xxl.job.core.handler.IJobHandler.JobHandleStatus;
|
|
5
|
+import com.xxl.job.core.log.XxlJobFileAppender;
|
|
6
|
+import com.xxl.job.core.util.HttpUtil;
|
|
7
|
+import org.eclipse.jetty.util.ConcurrentHashSet;
|
|
8
|
+import org.slf4j.Logger;
|
|
9
|
+import org.slf4j.LoggerFactory;
|
|
10
|
+
|
3
|
11
|
import java.io.PrintWriter;
|
4
|
12
|
import java.io.StringWriter;
|
5
|
13
|
import java.util.HashMap;
|
6
|
14
|
import java.util.Map;
|
7
|
15
|
import java.util.concurrent.LinkedBlockingQueue;
|
8
|
|
-import java.util.concurrent.TimeUnit;
|
9
|
|
-
|
10
|
|
-import org.eclipse.jetty.util.ConcurrentHashSet;
|
11
|
|
-import org.slf4j.Logger;
|
12
|
|
-import org.slf4j.LoggerFactory;
|
13
|
|
-
|
14
|
|
-import com.xxl.job.core.handler.HandlerRepository.HandlerParamEnum;
|
15
|
|
-import com.xxl.job.core.handler.IJobHandler.JobHandleStatus;
|
16
|
|
-import com.xxl.job.core.log.XxlJobFileAppender;
|
17
|
|
-import com.xxl.job.core.util.HttpUtil;
|
18
|
16
|
|
19
|
17
|
/**
|
20
|
18
|
* handler thread
|
|
@@ -57,7 +55,7 @@ public class HandlerThread extends Thread{
|
57
|
55
|
public void run() {
|
58
|
56
|
while(!toStop){
|
59
|
57
|
try {
|
60
|
|
- Map<String, String> handlerData = handlerDataQueue.poll();
|
|
58
|
+ Map<String, String> handlerData = handlerDataQueue.take();
|
61
|
59
|
if (handlerData!=null) {
|
62
|
60
|
i= 0;
|
63
|
61
|
String log_address = handlerData.get(HandlerParamEnum.LOG_ADDRESS.name());
|
|
@@ -103,17 +101,6 @@ public class HandlerThread extends Thread{
|
103
|
101
|
params.put("msg", "人工手动终止[业务运行中,被强制终止]");
|
104
|
102
|
HandlerRepository.pushCallBack(HttpUtil.addressToUrl(log_address), params);
|
105
|
103
|
}
|
106
|
|
- } else {
|
107
|
|
- i++;
|
108
|
|
- logIdSet.clear();
|
109
|
|
- try {
|
110
|
|
- TimeUnit.MILLISECONDS.sleep(i * 100);
|
111
|
|
- } catch (InterruptedException e) {
|
112
|
|
- e.printStackTrace();
|
113
|
|
- }
|
114
|
|
- if (i>5) {
|
115
|
|
- i= 0;
|
116
|
|
- }
|
117
|
104
|
}
|
118
|
105
|
} catch (Exception e) {
|
119
|
106
|
logger.info("HandlerThread Exception:", e);
|