コード例 #1
0
ファイル: Program.cs プロジェクト: vvasylkovskyi/DIDA-GSTORE
        private bool TryNotifyServerAboutCrashedServer(string partitionName, string serverId, string crashedServerId)
        {
            Console.WriteLine(">>> Notifying Server=" + serverId + " about CrashedServer=" + crashedServerId);

            try
            {
                reattachServer(serverId);
                NotifyCrashReply notifyCrashReply = client.NotifyCrash(new NotifyCrashRequest {
                    PartitionId = partitionName, CrashedMasterServerId = crashedServerId
                });
                Console.WriteLine(">>> Got Reply from ServerId=" + serverId);
                Console.WriteLine(">>> New Partition Master: PartitionName=" + partitionName + "PartitionMasterId=" + notifyCrashReply.MasterId);
                string masterId = notifyCrashReply.MasterId;

                PartitionMapping.SetPartitionMaster(partitionName, masterId);

                if (serverId != masterId)
                {
                    Console.WriteLine(">>> Reataching to new master. MasterId=" + masterId);
                    reattachServer(masterId);
                }
                else
                {
                    Console.WriteLine(">>> Already Attached to new master. MasterId=" + masterId);
                }
                return(true);
            }
            catch
            {
                Console.WriteLine(">>> No Reply...");
                return(false);
            }
        }
コード例 #2
0
        public NotifyCrashReply NotifyCrashHandler(NotifyCrashRequest request)
        {
            NotifyCrashReply reply;

            server.dealWithServerCrash(request.PartitionId, request.CrashedMasterServerId);

            reply = new NotifyCrashReply
            {
                Status = "OK"
            };
            return(reply);
        }