protected internal virtual BusinessProcessEvent createEvent(DelegateTask task) { ExecutionContext executionContext = Context.ExecutionContext; ProcessDefinitionEntity processDefinition = null; if (executionContext != null) { processDefinition = executionContext.ProcessDefinition; } // map type string eventName = task.EventName; BusinessProcessEventType type = null; if ([email protected]_Fields.EVENTNAME_CREATE.Equals(eventName)) { type = org.camunda.bpm.engine.cdi.BusinessProcessEventType_Fields.CREATE_TASK; } else if ([email protected]_Fields.EVENTNAME_ASSIGNMENT.Equals(eventName)) { type = org.camunda.bpm.engine.cdi.BusinessProcessEventType_Fields.ASSIGN_TASK; } else if ([email protected]_Fields.EVENTNAME_COMPLETE.Equals(eventName)) { type = org.camunda.bpm.engine.cdi.BusinessProcessEventType_Fields.COMPLETE_TASK; } else if ([email protected]_Fields.EVENTNAME_DELETE.Equals(eventName)) { type = org.camunda.bpm.engine.cdi.BusinessProcessEventType_Fields.DELETE_TASK; } return(new CdiBusinessProcessEvent(task, processDefinition, type, ClockUtil.CurrentTime)); }
public void Queue(MainLoopTask task) { DelegateTask dTask = cache.Dequeue(); dTask.Task = task; Queue(dTask); }
public ResultStatus CreateParametricData( DelegateTask delegateTask, DelegateTask_Request request, out DelegateTask_Result result) { return(this.CreateParametricData(delegateTask, (DelegateTask_Parameters)null, request, out result)); }
public ResultStatus ProcessComputation( DelegateTask delegateTask, DelegateTask_Request request, out DelegateTask_Result result) { return(this.ProcessComputation(delegateTask, (DelegateTask_Parameters)null, request, out result)); }
public ResultStatus DelegateApprover( DelegateTask delegateTask, DelegateTask_Request request, out DelegateTask_Result result) { return(this.DelegateApprover(delegateTask, (DelegateTask_DelegateApprover_Parameters)null, request, out result)); }
public ResultStatus LoadESigDetails( DelegateTask delegateTask, DelegateTask_Request request, out DelegateTask_Result result) { return(this.LoadESigDetails(delegateTask, (DelegateTask_LoadESigDetails_Parameters)null, request, out result)); }
void Loop() { while (true) { DelegateTask task = null; lock (tasks) { if (tasks.Count > 0) { task = tasks.Dequeue(); } } if (task == null) { handle.WaitOne(); } else { bool reuse = !task.IsBlocking; task.Execute(); if (reuse) { cache.Enqueue(task); } } Thread.Sleep(10); } }
public void RemoveTask(string name) { DelegateTask t = _tasks.Find(x => x.Name == name); t.Active = false; RemoveTask(t); }
private void Update() { if (Input.GetKeyDown(KeyCode.Space)) { timeSpinning = 0.0f; var jitterTimer = 0f; var moveAtMouse = new MoveTowardsMouseForSeconds(this, 2.0f); var spin = new DelegateTask(PickSpinRotation, SpinForSeconds); var jitter = new DelegateTask(() => {}, () => { jitterTimer += Time.deltaTime; var position = transform.position + 0.1f * Random.insideUnitSphere; position.z = 0; transform.position = position; return(jitterTimer > 3); }); moveAtMouse.Then(spin).Then(jitter); _tm.Do(moveAtMouse); } _tm.Update(); }
public virtual void notify(DelegateTask delegateTask) { // Note: we can't cache the result of the expression, because the // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' VariableScope variableScope = delegateTask.Execution; if (variableScope == null) { variableScope = delegateTask.CaseExecution; } object @delegate = expression.getValue(variableScope); applyFieldDeclaration(fieldDeclarations, @delegate); if (@delegate is TaskListener) { try { Context.ProcessEngineConfiguration.DelegateInterceptor.handleInvocation(new TaskListenerInvocation((TaskListener)@delegate, delegateTask)); } catch (Exception e) { throw new ProcessEngineException("Exception while invoking TaskListener: " + e.Message, e); } } else { throw new ProcessEngineException("Delegate expression " + expression + " did not resolve to an implementation of " + typeof(TaskListener)); } }
private object QueueWait(DelegateTask t) { if (t.Handle != null) { t.Handle.Reset(); } else { t.Handle = new ManualResetEvent(false); } if (Thread.CurrentThread == thread) { t.Execute(); } else { Queue(t); } t.Handle.WaitOne(); t.Handle.Close(); return(t.Result); }
void Loop() { while (true) { DelegateTask task = null; lock (_tasks) { if (_tasks.Count > 0) { task = _tasks.Dequeue(); } } if (task == null) { if (_disposeEnqueued) { _disposed = true; _disposeEnqueued = false; break; } _handle.WaitOne(); } else { task.Execute(); if (!task.IsBlocking) { _cache.Enqueue(task); } } } }
public virtual void notify(DelegateTask delegateTask) { foreach (DelegateTaskAsserter asserter in asserts) { asserter.doAssert(delegateTask); } }
private static Task DefineDialogueSequence() { Task enterDialogue = new DelegateTask(() => { Logger.Warning("DefineDialogueSequence start"); }, () => { return(Services.PlayerMovement.inPlaceForSequence); }); ActionTask triggerCameraAndUI = new ActionTask(() => { Logger.Warning("DefineDialogueSequence triggering camera to enter dialogue"); Services.CameraManager.EnterDialogue(); Services.UIManager.EnterDialogue(); }); Task fadeIn = new WaitTask(.5f); Task startConvo = new ActionTask(() => { Logger.Warning("DefineDialogueSequence entering dialogue"); Services.DialogueController.EnterDialogue(); _enterDialogueFailsafe.Abort(); }); enterDialogue.Then(triggerCameraAndUI).Then(fadeIn).Then(startConvo); return(enterDialogue); }
public ResultStatus GetWIPMsgs( DelegateTask delegateTask, DelegateTask_Request request, out DelegateTask_Result result) { return(this.GetWIPMsgs(delegateTask, (DelegateTask_Parameters)null, request, out result)); }
private void Queue(DelegateTask task) { lock (_tasks) { _tasks.Enqueue(task); _handle.Set(); } }
private void Queue(DelegateTask task, Priority priority) { lock (tasks) { tasks.Enqueue(task); handle.Set(); } }
// ******************************* PUBLIC METHODS ******************************************************************* public Scheduler.DelegateTask AddTask(string name, int interval, DelegateTask.DoItDelegate dlg, object what) { Debug.Assert(_tasks.Find(x => x.Name == name) == null); DelegateTask t = new DelegateTask(name, interval, dlg, what); t.Active = true; _tasks.Add(t); return(t); }
public DelegateTaskMethod( DelegateTask Cdo, DelegateTaskMethods Method, DelegateTask_Parameters Parameters) { this.Cdo = Cdo; this.ServiceMethod = Method; this.Parameters = Parameters; }
/// <summary> /// Queues work that will be run in the engine main thread. /// </summary> /// <param name="action">The action to run.</param> /// <param name="arg1">The first argument.</param> /// <param name="arg2">The second argument.</param> /// <param name="arg3">The third argument.</param> public static void QueueWork <T1, T2, T3>(Action <T1, T2, T3> action, T1 arg1, T2 arg2, T3 arg3) { if (action == null) { throw new ArgumentNullException("action"); } var task = new DelegateTask <T1, T2, T3>(action, arg1, arg2, arg3); QueueWork(task); }
public CdiBusinessProcessEvent(string activityId, string transitionName, ProcessDefinition processDefinition, DelegateExecution execution, BusinessProcessEventType type, DateTime timeStamp) { this.activityId = activityId; this.transitionName = transitionName; this.processInstanceId = execution.ProcessInstanceId; this.executionId = execution.Id; this.type = type; this.timeStamp = timeStamp; this.processDefinition = processDefinition; this.delegateTask = null; }
/// <summary> /// Queues work that will be run in the engine main thread. /// </summary> /// <param name="action">The action to run.</param> /// <param name="arg">The argument.</param> public static void QueueWork <T>(Action <T> action, T arg) { if (action == null) { throw new ArgumentNullException("action"); } var task = new DelegateTask <T>(action, arg); QueueWork(task); }
public CdiBusinessProcessEvent(DelegateTask task, ProcessDefinitionEntity processDefinition, BusinessProcessEventType type, DateTime timeStamp) { this.activityId = null; this.transitionName = null; this.processInstanceId = task.ProcessInstanceId; this.executionId = task.ExecutionId; this.type = type; this.timeStamp = timeStamp; this.processDefinition = processDefinition; this.delegateTask = task; }
/// <summary> /// Queues work that will be run in the engine main thread. /// </summary> /// <param name="action">The action to run.</param> public static void QueueWork(Action action) { if (action == null) { throw new ArgumentNullException("action"); } var task = new DelegateTask(action); QueueWork(task); }
private void JumpTasks() { float elapsedTime = 0f; const float duration = 9f / 60f; DelegateTask moveAndWait = new DelegateTask(() => { }, () => { elapsedTime += Time.fixedDeltaTime; Cont._charController.Move(Cont._currentMovementVector * _jumpingMovementMultiplier); return(elapsedTime > duration); }); DelegateTask jump = new DelegateTask( () => { Vector3 jumpVector = Cont.transform.forward * Cont._jumpForwardDistance;// + Vector3.up * Cont._upwardJumpSpeed; Cont._currentMovementVector += jumpVector * Time.deltaTime; Cont._currentMovementVector.y = Cont._jumpSpeed; }, () => { // Fall downwards Cont._currentMovementVector.y += Cont._gravity * Time.deltaTime; Cont._charController.Move(Cont._currentMovementVector); if (Cont.OnGround() || Cont._currentMovementVector.y <= 0f) { return(true); } return(false); }, () => { System.Type type = Cont._fsm.CurrentState.GetType(); if (type == typeof(InDialogueState) || type == typeof(CutsceneState) || type == typeof(ForcedIdleState)) { Logger.Warning($"Jump task finished outside of NPC area. Currently in {type.FullName}."); } else if (Cont._currentMovementVector.y < 0f) { TransitionTo <FallingState>(); } else if (Cont.GroundMovementInputsEntered) { TransitionTo <MovingOnGroundState>(); } else { TransitionTo <IdleState>(); } }); moveAndWait.Then(jump); Cont._taskManager.Do(moveAndWait); }
public uint QueueTimeout(TimeSpan span, TimeoutTask task) { DelegateTask dTask = cache.Dequeue(); dTask.Timeout = task; return(dispatcher.Add(span, delegate { QueueWait(dTask); return dTask.TimeoutResult; })); }
void Loop() { while (true) { DelegateTask task = null; lock (tasks) { if (tasks.Count > 0) { task = tasks.Dequeue(); } } if (task == null) { if (disposed) { break; } #if DISABLED // WARNING: if we are being disposed at _this_ point, there // are no new tasks added and we are waiting forever, then // we would leak this thread! The dispose check + break will // never happen, so we have to use a sane timeout here. // Checking every 60 seconds if we are disposed should be // reasonable. handle.WaitOne(60 * 1000); #endif // OPT: let Dispose() trigger the handle, but is this safe? handle.WaitOne(); } else { task.Execute(); if (task.Exception != null) { if (ExceptionEvent != null) { ExceptionEvent(this, new TaskQueueExceptionEventArgs(task.Exception)); } break; } } } if (AbortedEvent != null) { AbortedEvent(this, EventArgs.Empty); } }
public uint QueueTimeout(TimeSpan span, Func <bool> task) { DelegateTask dTask = new DelegateTask(); dTask.Timeout = task; return(_dispatcher.Add(span, (state, timeout) => { QueueWait(dTask); return dTask.TimeoutResult; })); }
public virtual void notify(DelegateTask task) { // test whether cdi is setup correctly. (if not, just do not deliver the event) if (!testCdiSetup()) { return; } BusinessProcessEvent @event = createEvent(task); Annotation[] qualifiers = getQualifiers(@event); BeanManager.fireEvent(@event, qualifiers); }
private void Queue(DelegateTask task)//, Priority priority = Priority.Normal) { if (task == null) { return; } lock (_tasks) { _tasks.Enqueue(task); _handle.Set(); } }
private void QueueWait(DelegateTask t) { t.WaitHandle.Reset(); t.IsBlocking = true; Queue(t); t.WaitHandle.WaitOne(); if (t.StoredException != null) throw new TorrentException("Exception in mainloop", t.StoredException); }
private void QueueWait(DelegateTask t) { t.WaitHandle.Reset(); t.IsBlocking = true; if (Thread.CurrentThread == thread) t.Execute(); else Queue(t, Priority.Highest); t.WaitHandle.WaitOne(); if (t.StoredException != null) throw new TorrentException("Exception in mainloop", t.StoredException); }
private void Queue(DelegateTask task) { Queue(task, Priority.Normal); }
private void Queue(DelegateTask task, Priority priority) { tasks.Add(task); }
private object QueueWait(DelegateTask t) { if (t.Handle != null) t.Handle.Reset(); else t.Handle = new ManualResetEvent(false); if (Thread.CurrentThread == thread) t.Execute(); else Queue(t); t.Handle.WaitOne(); t.Handle.Close(); return t.Result; }