asyncprimitivecontinuation.java

来自「一个很好的微工作流内核」· Java 代码 · 共 60 行

JAVA
60
字号
/* * 	  *  Copyright (c) 2002, 2003 Dragos Manolescu (dam@micro-workflow.com) *  *  See the LICENSE file for licensing information. */package com.microworkflow.execution;import com.microworkflow.process.WorkflowContext;public class AsyncPrimitiveContinuation extends Continuation {	protected Performer performer;	protected Object result;	protected String resultKey = null;	protected String targetKey = null;	protected boolean isScheduled = false;	public AsyncPrimitiveContinuation(Continuation continuation) {		super(continuation, continuation.getWorkflow());	}	public Continuation applyContinuationIn(final WorkflowContext context) {		Continuation ret = getNextContinuation().makeNullContinuation();				if (!isScheduled) {			performer.setTargetKey(targetKey);			performer.setResultKey(resultKey);			performer.setContext(context);			scheduleAsynchronousCommand(context);			isScheduled = true;			ret = getNextContinuation();			getWorkflow().addContinuation(this);		} else {			if (!performer.hasExecuted) {				ret = this;			} 		}		return ret;	}	public void scheduleAsynchronousCommand(final WorkflowContext context) {		Closure command = new Closure() {			public Object evaluate() {				performer.performOperation();					return this;						}		};		getScheduler().scheduleCommand(command);	}	public void setTargetKey(String targetKey) {		this.targetKey = targetKey;	}	public void setPerformer(Performer performer) {		this.performer = performer;	}	public void setResultKey(String resultKey) {		this.resultKey = resultKey;	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?