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 @Getter
private NotificationExecutorService notificationExecutor; private NotificationExecutorService notificationExecutor;
@Lazy
@Autowired @Autowired
@Getter @Getter
private PubSubRuleNodeExecutorProvider pubSubRuleNodeExecutorProvider; private PubSubRuleNodeExecutorProvider pubSubRuleNodeExecutorProvider;

View File

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

View File

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