/// <summary> /// On a derived class, this Method can push an SchedulingRequest, so it will be executed immediately /// </summary> /// <param name="requestId">the unique id of the request that requires immediate execution</param> /// <returns>a value indicating whether the request was found and pushing was successful</returns> public override bool PushRequest(string requestId) { bool retVal = false; lock (pendingRequests) { if (pendingRequests.Any(n => n.RequestId == requestId)) { DeferredScheduleRequest request = pendingRequests.First(n => n.RequestId == requestId); pendingRequests.Remove(request); request.Task.LastExecution = DateTime.Now; base.ScheduleTask(request); retVal = true; } } return(retVal); }
/// <summary> /// Creates a Task request for this TaskScheduler with the Task that needs to be executed and the queue that will execute it /// </summary> /// <param name="parallelTaskProcessor">the TaskProcessor that will run the provided task later</param> /// <param name="task">the task that needs to be executed</param> /// <param name="instruction">the main-instruction for this scheduler</param> /// <returns>a scheduler - request for the given processor and task</returns> public override ScheduleRequest CreateRequest(ParallelTaskProcessor parallelTaskProcessor, ITask task) { ScheduleRequest retVal = new DeferredScheduleRequest(UniqueName, parallelTaskProcessor, task, DateTime.Now); return(retVal); }