mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-06-13 03:11:10 +08:00
enhancement #I2NXDL slot 并发度控制数可以交由业务系统配置
This commit is contained in:
@@ -16,7 +16,7 @@ public class DataBus {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DataBus.class);
|
||||
|
||||
public static final int SLOT_SIZE = 1024;
|
||||
public static int SLOT_SIZE = 1024;
|
||||
|
||||
public static AtomicInteger OCCUPY_COUNT = new AtomicInteger(0);
|
||||
|
||||
@@ -52,4 +52,12 @@ public class DataBus {
|
||||
LOG.warn("slot[{}] already has been released",slotIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getSlotSize() {
|
||||
return SLOT_SIZE;
|
||||
}
|
||||
|
||||
public static void setSlotSize(int slotSize) {
|
||||
SLOT_SIZE = slotSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.yomahub.liteflow.springboot;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.entity.data.DataBus;
|
||||
import com.yomahub.liteflow.monitor.MonitorBus;
|
||||
import com.yomahub.liteflow.spring.ComponentScaner;
|
||||
import com.yomahub.liteflow.util.SpringAware;
|
||||
@@ -10,6 +11,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
@@ -17,6 +19,9 @@ import java.util.List;
|
||||
@Configuration
|
||||
@EnableConfigurationProperties({LiteflowProperty.class,LiteflowMonitorProperty.class})
|
||||
@ConditionalOnProperty(prefix = "liteflow", name = "rule-source")
|
||||
@PropertySource(
|
||||
name = "liteflow Default Properties",
|
||||
value = "classpath:/META-INF/liteflow-default.properties")
|
||||
public class LiteflowAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@@ -30,6 +35,9 @@ public class LiteflowAutoConfiguration {
|
||||
List<String> ruleList = Lists.newArrayList(property.getRuleSource().split(","));
|
||||
FlowExecutor flowExecutor = new FlowExecutor();
|
||||
flowExecutor.setRulePath(ruleList);
|
||||
|
||||
DataBus.setSlotSize(property.getSlotSize());
|
||||
|
||||
return flowExecutor;
|
||||
}else{
|
||||
return null;
|
||||
|
||||
@@ -5,13 +5,13 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@ConfigurationProperties(prefix = "liteflow.monitor", ignoreUnknownFields = true)
|
||||
public class LiteflowMonitorProperty {
|
||||
|
||||
private boolean enableLog = false;
|
||||
private boolean enableLog;
|
||||
|
||||
private int queueLimit = 200;
|
||||
private int queueLimit;
|
||||
|
||||
private long delay = 5*60*1000;
|
||||
private long delay;
|
||||
|
||||
private long period = 5*60*1000;
|
||||
private long period;
|
||||
|
||||
public boolean isEnableLog() {
|
||||
return enableLog;
|
||||
|
||||
@@ -7,6 +7,8 @@ public class LiteflowProperty {
|
||||
|
||||
private String ruleSource;
|
||||
|
||||
private int slotSize;
|
||||
|
||||
public String getRuleSource() {
|
||||
return ruleSource;
|
||||
}
|
||||
@@ -14,4 +16,12 @@ public class LiteflowProperty {
|
||||
public void setRuleSource(String ruleSource) {
|
||||
this.ruleSource = ruleSource;
|
||||
}
|
||||
|
||||
public int getSlotSize() {
|
||||
return slotSize;
|
||||
}
|
||||
|
||||
public void setSlotSize(int slotSize) {
|
||||
this.slotSize = slotSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
liteflow.ruleSource=config/flow.xml
|
||||
liteflow.slot-size=1024
|
||||
liteflow.monitor.enable-log=false
|
||||
liteflow.monitor.queue-limit=200
|
||||
liteflow.monitor.delay=300000
|
||||
liteflow.monitor.period=300000
|
||||
@@ -1,4 +1,2 @@
|
||||
liteflow.ruleSource=config/flow.xml
|
||||
liteflow.monitor.enable-log=true
|
||||
liteflow.monitor.delay=0
|
||||
liteflow.monitor.period=60000
|
||||
liteflow.slot-size=2048
|
||||
Reference in New Issue
Block a user