|
@@ -36,13 +36,16 @@ public class JobScheduleHelper {
|
36
|
36
|
scheduleThread = new Thread(new Runnable() {
|
37
|
37
|
@Override
|
38
|
38
|
public void run() {
|
39
|
|
- while (!toStop) {
|
40
|
|
- // 随机休眠1s内
|
41
|
|
- try {
|
42
|
|
- TimeUnit.MILLISECONDS.sleep(500+new Random().nextInt(500));
|
43
|
|
- } catch (InterruptedException e) {
|
|
39
|
+
|
|
40
|
+ try {
|
|
41
|
+ TimeUnit.MILLISECONDS.sleep(5000);
|
|
42
|
+ } catch (InterruptedException e) {
|
|
43
|
+ if (!toStop) {
|
44
|
44
|
logger.error(e.getMessage(), e);
|
45
|
45
|
}
|
|
46
|
+ }
|
|
47
|
+
|
|
48
|
+ while (!toStop) {
|
46
|
49
|
|
47
|
50
|
// 匹配任务
|
48
|
51
|
Connection conn = null;
|
|
@@ -139,6 +142,16 @@ public class JobScheduleHelper {
|
139
|
142
|
}
|
140
|
143
|
}
|
141
|
144
|
}
|
|
145
|
+
|
|
146
|
+ // 随机休眠1s内
|
|
147
|
+ try {
|
|
148
|
+ TimeUnit.MILLISECONDS.sleep(500+new Random().nextInt(500));
|
|
149
|
+ } catch (InterruptedException e) {
|
|
150
|
+ if (!toStop) {
|
|
151
|
+ logger.error(e.getMessage(), e);
|
|
152
|
+ }
|
|
153
|
+ }
|
|
154
|
+
|
142
|
155
|
}
|
143
|
156
|
logger.info(">>>>>>>>>>> xxl-job, JobScheduleHelper#scheduleThread stop");
|
144
|
157
|
}
|
|
@@ -154,6 +167,7 @@ public class JobScheduleHelper {
|
154
|
167
|
public void run() {
|
155
|
168
|
int lastSecond = -1;
|
156
|
169
|
while (!toStop) {
|
|
170
|
+
|
157
|
171
|
try {
|
158
|
172
|
// second data
|
159
|
173
|
List<Integer> ringItemData = new ArrayList<>();
|
|
@@ -195,7 +209,9 @@ public class JobScheduleHelper {
|
195
|
209
|
try {
|
196
|
210
|
TimeUnit.SECONDS.sleep(1);
|
197
|
211
|
} catch (InterruptedException e) {
|
198
|
|
- logger.error(e.getMessage(), e);
|
|
212
|
+ if (!toStop) {
|
|
213
|
+ logger.error(e.getMessage(), e);
|
|
214
|
+ }
|
199
|
215
|
}
|
200
|
216
|
}
|
201
|
217
|
logger.info(">>>>>>>>>>> xxl-job, JobScheduleHelper#ringThread stop");
|