added @Lazy to PubSubRuleNodeExecutorProvider

This commit is contained in:
dashevchenko 2023-11-17 14:45:38 +02:00
parent fbec7aab25
commit 66b768a499
3 changed files with 7 additions and 2 deletions

View File

@ -323,6 +323,7 @@ public class ActorSystemContext {
@Getter
private NotificationExecutorService notificationExecutor;
@Lazy
@Autowired
@Getter
private PubSubRuleNodeExecutorProvider pubSubRuleNodeExecutorProvider;

View File

@ -16,15 +16,19 @@
package org.thingsboard.server.service.executors;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.thingsboard.common.util.ExecutorProvider;
import org.thingsboard.common.util.ThingsBoardThreadFactory;
import org.thingsboard.server.queue.util.TbRuleEngineComponent;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@Lazy
@TbRuleEngineComponent
@Component
public class PubSubRuleNodeExecutorProvider implements ExecutorProvider {
@ -53,7 +57,7 @@ public class PubSubRuleNodeExecutorProvider implements ExecutorProvider {
@PreDestroy
private void destroy() {
if (executor != null) {
executor.shutdown();
executor.shutdownNow();
}
}
}

View File

@ -54,7 +54,7 @@ public class TbPubSubQueueExecutorProvider implements ExecutorProvider {
@PreDestroy
private void destroy() {
if (executor != null) {
executor.shutdown();
executor.shutdownNow();
}
}
}