From bd43e97ba44a0139128286add8292b45ec9cb467 Mon Sep 17 00:00:00 2001 From: bryan31 Date: Thu, 18 Mar 2021 18:37:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DMonitorBus=E5=BF=85=E9=A1=BB?= =?UTF-8?q?=E5=BE=97=E6=B3=A8=E5=85=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yomahub/liteflow/core/NodeComponent.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java b/liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java index 1c03ebf1f..6f8a2ff43 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java @@ -7,6 +7,7 @@ */ package com.yomahub.liteflow.core; +import cn.hutool.core.util.ObjectUtil; import com.yomahub.liteflow.entity.flow.Executable; import com.yomahub.liteflow.spring.ComponentScaner; import org.apache.commons.lang3.StringUtils; @@ -23,6 +24,7 @@ import com.yomahub.liteflow.entity.monitor.CompStatistics; import com.yomahub.liteflow.flow.FlowBus; import com.yomahub.liteflow.monitor.MonitorBus; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.lang.Nullable; import javax.annotation.Resource; @@ -32,7 +34,7 @@ public abstract class NodeComponent { private InheritableThreadLocal slotIndexTL = new InheritableThreadLocal(); - @Resource + @Autowired(required = false) private MonitorBus monitorBus; private String nodeId; @@ -68,7 +70,9 @@ public abstract class NodeComponent { CompStatistics statistics = new CompStatistics(); statistics.setComponentClazzName(this.getClass().getSimpleName()); statistics.setTimeSpent(timeSpent); - monitorBus.addStatistics(statistics); + if (ObjectUtil.isNotNull(monitorBus)){ + monitorBus.addStatistics(statistics); + } if(this instanceof NodeCondComponent){ String condNodeId = slot.getCondResult(this.getClass().getName());