小修正

This commit is contained in:
bryan.zhang
2017-12-04 14:27:07 +08:00
parent ab8b6102e6
commit aa6a347d52
7 changed files with 59 additions and 5 deletions

1
deploy.bat Normal file
View File

@@ -0,0 +1 @@
mvn clean install deploy

29
pom.xml
View File

@@ -13,6 +13,7 @@
<commons.lang3.version>3.4</commons.lang3.version>
<commons-collections.version>4.1</commons-collections.version>
<commons-io.version>2.4</commons-io.version>
<commons-logging.version>1.2</commons-logging.version>
<spring.version>4.2.6.RELEASE</spring.version>
<org.slf4j.version>1.7.21</org.slf4j.version>
<log4j.version>1.2.17</log4j.version>
@@ -49,6 +50,16 @@
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
@@ -84,6 +95,11 @@
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${commons-logging.version}</version>
</dependency>
</dependencies>
<build>
@@ -107,4 +123,17 @@
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>nexus-releases</name>
<url>http://118.178.236.200:8087/nexus/content/repositories/thirdparty</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>nexus-snapshots</name>
<url>http://118.178.236.200:8087/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>

View File

@@ -23,6 +23,7 @@ import com.thebeastshop.liteflow.entity.config.Node;
import com.thebeastshop.liteflow.entity.config.ThenCondition;
import com.thebeastshop.liteflow.entity.config.WhenCondition;
import com.thebeastshop.liteflow.entity.data.DataBus;
import com.thebeastshop.liteflow.exception.FlowException;
import com.thebeastshop.liteflow.flow.FlowBus;
import com.thebeastshop.liteflow.parser.FlowParser;
@@ -78,13 +79,15 @@ public class FlowExecutor {
if(component.isAccess()){
component.execute();
}else{
LOG.info("component[{}] do not gain access",component.getClass().getSimpleName());
LOG.error("component[{}] do not gain access",component.getClass().getSimpleName());
throw new FlowException("component ["+component.getClass().getSimpleName()+"] do not gain access");
}
}catch(Throwable t){
if(component.isContinueOnError()){
LOG.error("component[{}] cause error,but flow is still go on",t,component.getClass().getSimpleName());
}else{
throw new Exception(t);
LOG.error(t.getMessage(),t);
throw t;
}
}
}
@@ -100,7 +103,7 @@ public class FlowExecutor {
return DataBus.getSlot(slotIndex).getResponseData();
}catch(Exception e){
LOG.error("executor cause error",e);
return null;
throw new FlowException("executor cause error");
}finally{
DataBus.releaseSlot(slotIndex);
}

View File

@@ -0,0 +1,21 @@
package com.thebeastshop.liteflow.exception;
public class FlowException extends RuntimeException {
private static final long serialVersionUID = 1L;
/** 异常信息 */
private String message;
public FlowException(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}

View File

@@ -25,7 +25,7 @@ public class TestWithSpringMain {
public void test1() throws Exception {
ExecutorService executorService = Executors.newFixedThreadPool(10);
for(int i=0;i<100;i++){
for(int i=0;i<1;i++){
executorService.submit(new Thread(){
@Override
public void run() {

View File

@@ -13,7 +13,7 @@
<bean id="flowExecutor" class="com.thebeastshop.liteflow.core.FlowExecutor" init-method="init">
<property name="rulePath">
<list>
<value>flow.xml</value>
<value>config/flow.xml</value>
</list>
</property>
</bean>