public List <string> GetTaskRuntimeNodeNames(TinctTask task) { List <string> result = new List <string>(); var list = currentRuntimeTasks.Where(t => t.ClassName == task.ClassName && t.MethodName == task.MethodName).Select(t => t.TargetNodeName); return(list == null?null:list.ToList()); }
public void UpdateRunningTask(TinctTask task) { lock (syncruntimetasks) { var currenttask = currentRuntimeTasks.Where(t => t.ID == task.ID).FirstOrDefault(); if (currenttask == null) { return; } currenttask.Status = task.Status; switch (task.Status) { case TinctTaskStatus.Completed: currentRuntimeTasks.Remove(currenttask); if (currenttask.TinctTaskCompleted != null) { new Task(() => { currenttask.TinctTaskCompleted(currenttask); }).Start(); } logger.LogMessage(task.ToJsonSerializeString()); break; case TinctTaskStatus.Exception: case TinctTaskStatus.Faulted: currentRuntimeTasks.Remove(currenttask); logger.LogMessage(task.ToJsonSerializeString()); break; default: break; } } }
public void UpdateWaittingTask(TinctTask task) { lock (syncWaittingtasks) { var currenttask = queueWaittingTasks.Where(t => t.ClassName == task.ClassName && t.MethodName == task.MethodName).FirstOrDefault(); if (currenttask == null) { return; } switch (task.Status) { case TinctTaskStatus.Completed: queueWaittingTasks.Remove(currenttask); QueueTinctTask(currenttask); break; case TinctTaskStatus.Exception: case TinctTaskStatus.Faulted: queueWaittingTasks.Remove(currenttask); QueueTinctTask(currenttask); break; default: break; } } }
public void QueueTinctTask(TinctTask task) { queueTasks.Enqueue(task); if (task.Status == TinctTaskStatus.Created) { logger.LogMessage(task.ToJsonSerializeString()); } syncTaskSignal.Set(); }
public void AddRunningTask(TinctTask task) { lock (syncruntimetasks) { task.Status = TinctTaskStatus.Running; currentRuntimeTasks.Add(task); } logger.LogMessage(task.ToJsonSerializeString()); }
public void AddWaittingTask(TinctTask task) { lock (syncWaittingtasks) { task.Status = TinctTaskStatus.Waitting; queueWaittingTasks.Add(task); } logger.LogMessage(task.ToJsonSerializeString()); }
public static TinctTask GetObjectBySerializeString(string serializeString) { TinctTask obj = null; JsonSerializer serializer = new JsonSerializer(); using (StringReader reader = new StringReader(serializeString)) { try { obj = serializer.Deserialize <TinctTask>(new JsonTextReader(reader)); } catch { throw; } return(obj); } }