xworker.flow.ThingFlowNode Maven / Gradle / Ivy
/*******************************************************************************
* Copyright 2007-2013 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package xworker.flow;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmeta.Thing;
/**
* 流程节点。
*
* @author zyx
*
*/
public class ThingFlowNode implements Runnable{
private static Logger log = LoggerFactory.getLogger(ThingFlowNode.class);
Thing flowThing;
ThingFlow thingFlow;
public ThingFlowNode(ThingFlow thingFlow, Thing flowThing){
this.thingFlow = thingFlow;
this.flowThing = flowThing;
}
public Thing getFlowThing() {
return flowThing;
}
public ThingFlow getThingFlow() {
return thingFlow;
}
public void run(){
synchronized(this){ //同步
try{
//log.info("" + thingFlow + " " + thingFlow.threads.size());
thingFlow.invokeNode(this, flowThing);
}finally{
thingFlow.threads.remove(this);
//log.info("" + thingFlow + " " + thingFlow.threads.size());
thingFlow.checkClose();
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy