支持在NodeComponent里自定义beforeProcess和afterProcess,没有覆盖方式时,默认读取aspect里的方法

This commit is contained in:
陈秀信
2021-10-15 10:53:42 +08:00
parent 36c8b9a35e
commit 1b8e19d063

View File

@@ -73,17 +73,9 @@ public abstract class NodeComponent {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
// process前置处理
if (ObjectUtil.isNotNull(ComponentScanner.cmpAroundAspect)) {
ComponentScanner.cmpAroundAspect.beforeProcess(this.getNodeId(), slot);
}
self.beforeProcess(this.getNodeId(), slot);
self.process();
// process后置处理
if (ObjectUtil.isNotNull(ComponentScanner.cmpAroundAspect)) {
ComponentScanner.cmpAroundAspect.afterProcess(this.getNodeId(), slot);
}
self.afterProcess(this.getNodeId(), slot);
stopWatch.stop();
@@ -109,6 +101,25 @@ public abstract class NodeComponent {
public abstract void process() throws Exception;
/**
* process前置处理
*/
public void beforeProcess(String nodeId, Slot slot) {
if (ObjectUtil.isNotNull(ComponentScanner.cmpAroundAspect)) {
ComponentScanner.cmpAroundAspect.beforeProcess(nodeId, slot);
}
}
/**
* process后置处理
*/
public void afterProcess(String nodeId, Slot slot) {
if (ObjectUtil.isNotNull(ComponentScanner.cmpAroundAspect)) {
ComponentScanner.cmpAroundAspect.afterProcess(nodeId, slot);
}
}
/**
* 是否进入该节点
* @return boolean