/// <summary> /// Create a new dispatcher and add to the good dispatcher pool. /// </summary> /// <param name="taskid">HPC Task Id</param> /// <param name="node">Name of node this dispatcher is for</param> /// <param name="state">State of task when dispatcher is created (always Running now)</param> /// <returns>Dispatcher that was added, or null if a dispatcher already exists in the good pool for specified node</returns> private Dispatcher AddDispatcher(int taskid, string node, VertexTaskState state) { VertexComputeNode cn = new VertexComputeNode(); cn.instanceId = taskid; cn.ComputeNode = node; cn.State = state; Dispatcher d = new Dispatcher(schedulerHelper, cn); d.FaultedEvent += new DispatcherFaultedEventHandler(OnDispatcherFaulted); if (!dispatcherPool.Add(d)) { // There's already a dispatcher for this node d.Dispose(); d = null; } return d; }