コード例 #1
0
        private void contactReplicas()
        {
            foreach (string opName in operatorsInfo.OperatorNames)
            {
                OperatorBuilder opb             = operatorsInfo.getOpInfo(opName);
                string          routing         = null;
                string          incomingRouting = null;
                List <string>   output          = null;
                List <string>   input           = null;
                List <string>   operation       = new List <string>();

                // Setting the common parameters between replicas
                try {
                    routing         = operatorsInfo.getMyRouting(opb.Name);
                    incomingRouting = operatorsInfo.getMyIncomingRouting(opb.Name);
                    output          = operatorsInfo.getOuputAddressesListOfOP(opb.Name);
                    input           = operatorsInfo.getInputAddressesListOfOP(opb.Name);
                } catch (LastOperatorException) {
                    routing         = "primary";
                    incomingRouting = "primary";
                    output          = new List <string>();
                    input           = new List <string>();
                }

                operation.Add(opb.OperatorType);
                operation.Add(string.Join(",", opb.SpecificParameters));

                // Contacting all the operator's PCS
                for (int i = 0; i < opb.RepFactor; i++)
                {
                    Console.WriteLine("- Replica number " + i);
                    Console.WriteLine("Machine Address: {0}\t port: {1}", urlsplitter.getAddress(opb.Addresses[i]), urlsplitter.getPort(opb.Addresses[i]));

                    string address = urlsplitter.getAddress(opb.Addresses[i]);
                    Console.WriteLine("Calling PCS on address " + address);

                    try {
                        CommonClasses.IProcessCreator obj = (CommonClasses.IProcessCreator)Activator.GetObject(typeof(CommonClasses.IProcessCreator),
                                                                                                               "tcp://" + address + ":" + PCS_RESERVED_PORT + "/ProcessCreator");

                        obj.createReplica("tcp://" + puppetMasterIPAddress.ToString() + ":" + LOGGING_PORT.ToString(),
                                          routing, incomingRouting, semantics, loggingLevel, i, operation, opb.Addresses, output, input);
                    }
                    catch (System.Net.Sockets.SocketException e) {
                        Console.WriteLine("Error with host " + address);
                        Console.WriteLine("Exception " + e);
                    }
                }
            }
        }
コード例 #2
0
        public override void execute(string[] args)
        {
            if (args.Length < 2)
            {
                throw new WrongNumberOfArgsException();
            }

            OperatorBuilder opb;
            int             interval;

            if ((opb = operatorsInfo.getOpInfo(args[0])) == null)
            {
                throw new WrongOperatorException();
            }

            if (!int.TryParse(args[1], out interval))
            {
                throw new WrongTypeOfArgException();
            }

            foreach (string addr in opb.Addresses)
            {
                ReplicaInterface            obj       = (ReplicaInterface)Activator.GetObject(typeof(ReplicaInterface), addr);
                RemoteAsyncDelegateWithTime RemoteDel = new RemoteAsyncDelegateWithTime(obj.Interval);
                IAsyncResult RemAr = RemoteDel.BeginInvoke(interval, null, obj);
            }
        }
コード例 #3
0
        public override void execute(string[] args)
        {
            if (args.Length < 2)
            {
                throw new WrongNumberOfArgsException();
            }

            OperatorBuilder opb;
            int             repIndex;

            if ((opb = operatorsInfo.getOpInfo(args[0])) == null)
            {
                throw new WrongOperatorException();
            }

            if (!int.TryParse(args[1], out repIndex))
            {
                throw new WrongTypeOfArgException();
            }

            if (!(repIndex < opb.Addresses.Count && repIndex >= 0))
            {
                throw new IndexOutOfBoundsException();
            }

            ReplicaInterface    obj       = (ReplicaInterface)Activator.GetObject(typeof(ReplicaInterface), opb.Addresses[repIndex]);
            RemoteAsyncDelegate RemoteDel = new RemoteAsyncDelegate(obj.Unfreeze);
            IAsyncResult        RemAr     = RemoteDel.BeginInvoke(null, obj);
        }
コード例 #4
0
        public override void execute(string[] args)
        {
            if (args.Length > 0)
            {
                OperatorBuilder opb;

                if ((opb = operatorsInfo.getOpInfo(args[0])) == null)
                {
                    throw new WrongOperatorException();
                }

                if (args.Length > 1)
                {
                    int repIndex;

                    if (!int.TryParse(args[1], out repIndex))
                    {
                        throw new WrongTypeOfArgException();
                    }

                    if (!(repIndex < opb.Addresses.Count && repIndex >= 0))
                    {
                        throw new IndexOutOfBoundsException();
                    }

                    string address = opb.Addresses[repIndex];
                    callSpecificReplica(address);
                }
                else
                {
                    callAllReplicas(opb);
                }
            }
            else
            {
                callAllOperators();
            }
        }
コード例 #5
0
        public override void execute(string[] args)
        {
            if (args.Length == 0)
            {
                throw new WrongNumberOfArgsException();
            }

            OperatorBuilder opb;

            if ((opb = operatorsInfo.getOpInfo(args[0])) == null)
            {
                throw new WrongOperatorException();
            }

            foreach (string addr in opb.Addresses)
            {
                ReplicaInterface obj = (ReplicaInterface)Activator.GetObject(typeof(ReplicaInterface), addr);

                RemoteAsyncDelegate RemoteDel = new RemoteAsyncDelegate(obj.Start);
                IAsyncResult        RemAr     = RemoteDel.BeginInvoke(null, obj);
            }
        }