public bool init(List <NodeOperatorData> nodesInformation) { if (!IsStarted) { foreach (var OpID in nodesInformation.GroupBy(group => group.OperatorID).Select(group => group.First())) { OPtoNodes.Add(OpID.OperatorID, new List <string>()); } foreach (var node in nodesInformation) { NodeOperator.NodeOperator newNode = new NodeOperator.NodeOperator(node); Thread t1 = new Thread(new ThreadStart(newNode.nodeCommunication)); t1.Start(); //t1.IsBackground = true; t1.Join(); var pass = "******" + node.ConnectionPort + "/" + node.OperatorName + node.ConnectionPort; nodeThreads.Add(pass, t1); /*operatorID should be the machine IP*/ INodeOperator nodeOp = (INodeOperator)Activator.GetObject(typeof(INodeOperator), pass); GC.KeepAlive(nodeOp); OPtoNodes[node.OperatorID].Add(pass); nodeOperators.Add(pass, nodeOp); /*operatorID should be the machine IP*/ } IsStarted = true; } return(IsStarted); }
private INodeOperator replicateTuplesToNode(string remoteLocation) { INodeOperator nodeOp = (INodeOperator)Activator.GetObject(typeof(INodeOperator), remoteLocation); AsyncCallback asyncCallback = new AsyncCallback(this.nodeReplicationCallBack); nodeReplicationAsync remoteDel = new nodeReplicationAsync(nodeOp.replicateTuples); IAsyncResult ar = remoteDel.BeginInvoke(OutputTuples, asyncCallback, null); return(nodeOp); }
public void start(string v) { foreach (var node in OPtoNodes[v]) { INodeOperator nodeOp = nodeOperators[node]; //nodeOp.makeNodeWork(); AsyncCallback asyncCallback = new AsyncCallback(testCallBack); testAsync remoteDel = new testAsync(nodeOp.makeNodeWork); IAsyncResult ar = remoteDel.BeginInvoke(null, asyncCallback); } }