Example #1
0
 /// <summary>
 /// Send periodic heart beats to the master
 /// </summary>
 /// <param name="state"></param>
 public void SendHeartBeatMessage(object state)
 {
     if (!isThisServerFailed)
     {
         PADI_Master master = (PADI_Master)Activator.GetObject(typeof(PADI_Master), Common.GetMasterTcpUrl());
         //if (!master.FailServerList.Exists(s => s.ServerName == thisServer.ServerName))
         master.HeartBeatReceiver(thisServer.ServerName);
     }
 }
Example #2
0
        /// <summary>
        /// Bootstarp object servers with the master
        /// </summary>
        /// <param name="workerPort"></param>
        /// <returns></returns>
        public bool BootstrapMaster(string workerPort)
        {
            bool   isBootstraped = false;
            String masterUrl     = Common.GetMasterTcpUrl();
            //String workerIp = Common.GetLocalIPAddress();
            String      workerIp  = ConfigurationManager.AppSettings[Constants.APPSET_WORKER_IP];
            PADI_Master masterObj = (PADI_Master)Activator.GetObject(typeof(PADI_Master), masterUrl);

            thisServer = masterObj.Bootstrap(workerIp, workerPort);
            if (thisServer != null)
            {
                isBootstraped = true;
            }
            Console.WriteLine("Worker server :" + thisServer.ServerName + "started. Bootstrap status:" + isBootstraped);
            Common.Logger().LogInfo("Worker server :" + thisServer.ServerName + " started", "Port : " + workerPort, "Bootstrap status:" + isBootstraped);
            return(isBootstraped);
        }
Example #3
0
        public static bool Init()
        {
            bool isInitSuccessful = false;

            try
            {
                //TODO:Load the Info object when start and save it when client exit. Currently new object is created.
                coordinator = (PADI_Coordinator)Activator.GetObject(typeof(PADI_Coordinator), Common.GenerateTcpUrl(ConfigurationManager.AppSettings[Constants.APPSET_MASTER_IP], ConfigurationManager.AppSettings[Constants.APPSET_MASTER_PORT], Constants.OBJECT_TYPE_PADI_COORDINATOR));
                master      = (PADI_Master)Activator.GetObject(typeof(PADI_Master), Common.GetMasterTcpUrl());
                workers     = new List <PADI_Worker>();
                info        = new Information();
                padIntUids  = new List <int>();
                LoadServerMap();
                isInitSuccessful = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(isInitSuccessful);
        }
Example #4
0
 public PADI_Coordinator(PADI_Master master)
 {
     this.master          = master;
     transactionIdDict    = new Dictionary <long, List <OperationRequestStatus> >();
     HasHaltTidGeneration = false;
 }