mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 12:12:08 +08:00
slot增加了requestId属性
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
||||
<artifactId>liteflow</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>1.2.8</version>
|
||||
<version>1.2.9</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -94,6 +95,10 @@ public class FlowExecutor {
|
||||
throw new NoAvailableSlotException("the slot is not exist");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(slot.getRequestId())) {
|
||||
slot.generateRequestId();
|
||||
}
|
||||
|
||||
if(!isInnerChain) {
|
||||
slot.setRequestData(param);
|
||||
}else {
|
||||
|
||||
@@ -36,6 +36,8 @@ public abstract class AbsSlot implements Slot{
|
||||
|
||||
private final String CHAIN_REQ_PREFIX = "chain_req_";
|
||||
|
||||
private final String REQUEST_ID = "req_id";
|
||||
|
||||
private Deque<CmpStep> executeSteps = new ArrayDeque<CmpStep>();
|
||||
|
||||
protected ConcurrentHashMap<String, Object> dataMap = new ConcurrentHashMap<String, Object>();
|
||||
@@ -117,4 +119,14 @@ public abstract class AbsSlot implements Slot{
|
||||
}
|
||||
LOG.info(str.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRequestId() {
|
||||
dataMap.put(REQUEST_ID, System.nanoTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRequestId() {
|
||||
return (String)dataMap.get(REQUEST_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,4 +41,8 @@ public interface Slot {
|
||||
public void addStep(CmpStep step);
|
||||
|
||||
public void printStep();
|
||||
|
||||
public void generateRequestId();
|
||||
|
||||
public String getRequestId();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user