snaker-core/src/main/java/org/snaker/engine/handlers/impl/StartSubProcessHandler.java
public void handle(Execution execution) {
		//根据子流程模型名称获取子流程定义对象
		SnakerEngine engine = execution.getEngine();
		Process process = engine.process().getProcessByVersion(model.getProcessName(), model.getVersion());
		
		Execution child = execution.createSubExecution(execution, process, model.getName());
		Order order = null;
		if(isFutureRunning) {
			//创建单个线程执行器来执行启动子流程的任务
			ExecutorService es = Executors.newSingleThreadExecutor();
			//提交执行任务，并返回future
			Future<Order> future = es.submit(new ExecuteTask(execution, process, model.getName()));
			try {
				es.shutdown();
				order = future.get();
			} catch (InterruptedException e) {
				throw new SnakerException("创建子流程线程被强制终止执行", e.getCause());
			} catch (ExecutionException e) {
				throw new SnakerException("创建子流程线程执行异常.", e.getCause());
			}
		} else {
			order  = engine.startInstanceByExecution(child);
		}
		AssertHelper.notNull(order, "子流程创建失败");
		execution.addTasks(engine.query().getActiveTasks(new QueryFilter().setOrderId(order.getId())));
	}
public void handle(Execution execution) {
		//根据子流程模型名称获取子流程定义对象
		SnakerEngine engine = execution.getEngine();
		Process process = engine.process().getProcessByVersion(model.getProcessName(), model.getVersion());
		
		Execution child = execution.createSubExecution(execution, process, model.getName());
		Order order = null;
		if(isFutureRunning) {
			//创建单个线程执行器来执行启动子流程的任务
			ExecutorService es = Executors.newSingleThreadExecutor();
			//提交执行任务，并返回future
			Future<Order> future = es.submit(new ExecuteTask(execution, process, model.getName()));
			try {
				es.shutdown();
				order = future.get();
			} catch (InterruptedException e) {
				throw new SnakerException("创建子流程线程被强制终止执行", e.getCause());
			} catch (ExecutionException e) {
				throw new SnakerException("创建子流程线程执行异常.", e.getCause());
			}
		} else {
			order  = engine.startInstanceByExecution(child);
		}
		AssertHelper.notNull(order, "子流程创建失败");
		execution.addTasks(engine.query().getActiveTasks(new QueryFilter().setOrderId(order.getId())));
	}
public void handle ( Execution execution ) { //根据子流程模型名称获取子流程定义对象 SnakerEngine engine = execution . getEngine ( ) ; Process process = engine . process ( ) . getProcessByVersion ( model . getProcessName ( ) , model . getVersion ( ) ) ; Execution child = execution . createSubExecution ( execution , process , model . getName ( ) ) ; Order order = null ; if ( isFutureRunning ) { //创建单个线程执行器来执行启动子流程的任务 ExecutorService es = Executors . newSingleThreadExecutor ( ) ; //提交执行任务，并返回future Future < Order > future = es . submit ( new ExecuteTask ( execution , process , model . getName ( ) ) ) ; try { es . shutdown ( ) ; order = future . get ( ) ; } catch ( InterruptedException e ) { throw new SnakerException ( "创建子流程线程被强制终止执行", e.getCause()); } catch ( ExecutionException e ) { throw new SnakerException ( "创建子流程线程执行异常.", e.getCause()); } } else { order = engine . startInstanceByExecution ( child ) ; } AssertHelper . notNull ( order , "子流程创建失败"); execution . addTasks ( engine . query ( ) . getActiveTasks ( new QueryFilter ( ) . setOrderId ( order . getId ( ) ) ) ) ; }
子流程执行的处理
子流程执行的处理