REQ-2481: 处理关闭
This commit is contained in:
parent
0ef8101197
commit
0e1a0ec0b8
@ -31,6 +31,8 @@ import java.util.function.Supplier;
|
||||
@RequiredArgsConstructor
|
||||
public class ScanAndSendService {
|
||||
|
||||
static volatile boolean isShutdown = false;
|
||||
|
||||
private final ApplicationContext applicationContext;
|
||||
private final SendJobInfoMapper sendJobInfoMapper;
|
||||
private final ForkJoinPool threadPool = new ForkJoinPool(15);
|
||||
@ -140,4 +142,9 @@ public class ScanAndSendService {
|
||||
return sendJobInfo;
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> isShutdown = true));
|
||||
}
|
||||
|
||||
}
|
||||
@ -39,6 +39,8 @@ class SendManager {
|
||||
public boolean isInterrupted() {
|
||||
if (execInterrupted || someoneJumpedTheQueue)
|
||||
return true;
|
||||
if (ScanAndSendService.isShutdown)
|
||||
return true;
|
||||
if (Thread.currentThread().isInterrupted())
|
||||
return true;
|
||||
if (!cfg.isEnableJumpTheQueue())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user