package com.oneliang.util.task;

import com.oneliang.Constant;
import com.oneliang.util.concurrent.ThreadTask;
import com.oneliang.util.logging.Logger;
import com.oneliang.util.logging.LoggerManager;

public class TaskNodeThreadTask implements ThreadTask {

	private static final Logger logger=LoggerManager.getLogger(TaskNodeThreadTask.class);

	private TaskEngine taskEngine=null;
	private TaskNode taskNode=null;
	public TaskNodeThreadTask(TaskEngine taskEngine,TaskNode taskNode) {
		this.taskEngine=taskEngine;
		this.taskNode=taskNode;
	}
	public void runTask() {
		long begin=System.currentTimeMillis();
		logger.verbose(taskNode.getName()+" ready");
		while(!taskNode.isAllParentFinished()){
			synchronized(taskNode){
				try {
					taskNode.wait();
				} catch (InterruptedException e) {
					logger.error(Constant.Base.EXCEPTION, e);
				}
			}
		}
		long runBegin=System.currentTimeMillis();
		try{
			if(taskNode.getRunnable()!=null){
				logger.verbose(taskNode.getName()+" start");
				taskNode.getRunnable().run();
			}
		}catch(Exception e){
			logger.error(Constant.Base.EXCEPTION, e);
			taskEngine.setSuccessful(false);
		}finally{
			taskNode.setFinished(true);
		}
		long runCost=System.currentTimeMillis()-runBegin;
		if(taskNode.getChildTaskNodeList()!=null&&!taskNode.getChildTaskNodeList().isEmpty()){
			for(TaskNode childTaskNode:taskNode.getChildTaskNodeList()){
//				taskEngine.executeTaskNode(childTaskNode);
				synchronized(childTaskNode){
					childTaskNode.notify();
				}
			}
		}
		long taskCost=System.currentTimeMillis()-begin;
		logger.verbose(taskNode.getName()+" end,task cost:"+taskCost+",run cost:"+runCost+",waiting:"+(taskCost-runCost));
		this.taskNode.setRunCostTime(runCost);
		if(this.taskEngine.isDefaultMode()){
			if(this.taskEngine.isAllTaskNodeFinished()){
				synchronized (this.taskEngine) {
					this.taskEngine.notify();
				}
			}
		}
	}
}

@@ -605,39 +605,36 @@
 lis();%0A%09%09logger.
-verbose
+info
 (taskNode.getNam
@@ -941,39 +941,36 @@
 ll)%7B%0A%09%09%09%09logger.
-verbose
+info
 (taskNode.getNam
@@ -1568,15 +1568,12 @@
 ger.
-verbose
+info
 (tas

change log level of TaskNodeThreadTask.java