Shutdown notification scheduler in PreDestroy
This commit is contained in:
parent
a4908f758c
commit
fcea425dbf
@ -41,6 +41,7 @@ import org.thingsboard.server.service.executors.NotificationExecutorService;
|
|||||||
import org.thingsboard.server.service.partition.AbstractPartitionBasedService;
|
import org.thingsboard.server.service.partition.AbstractPartitionBasedService;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.annotation.PreDestroy;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -66,6 +67,7 @@ public class DefaultNotificationSchedulerService extends AbstractPartitionBasedS
|
|||||||
|
|
||||||
private final Map<NotificationRequestId, ScheduledRequestMetadata> scheduledNotificationRequests = new ConcurrentHashMap<>();
|
private final Map<NotificationRequestId, ScheduledRequestMetadata> scheduledNotificationRequests = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
super.init();
|
super.init();
|
||||||
@ -167,6 +169,13 @@ public class DefaultNotificationSchedulerService extends AbstractPartitionBasedS
|
|||||||
return "notifications-scheduler";
|
return "notifications-scheduler";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@PreDestroy
|
||||||
|
public void stop() {
|
||||||
|
super.stop();
|
||||||
|
scheduler.shutdownNow();
|
||||||
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
private static class ScheduledRequestMetadata {
|
private static class ScheduledRequestMetadata {
|
||||||
private final TenantId tenantId;
|
private final TenantId tenantId;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user