コード例 #1
0
        internal static RpcKillServiceImpl.Reply SendKillRequest(string serverName, string serviceName, DateTime minTimeCheck, bool isForce, int timeoutInMSec)
        {
            Exception ex = null;

            RpcKillServiceImpl.Reply reply = null;
            bool isSucceded = false;
            bool flag       = true;

            try
            {
                ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
                {
                    ReplayCrimsonEvents.SendingServiceKillRequest.Log <string, string>(serviceName, serverName);
                    RpcKillServiceImpl.Request attachedRequest = new RpcKillServiceImpl.Request(serviceName, minTimeCheck, false);
                    RpcGenericRequestInfo requestInfo          = ActiveManagerGenericRpcHelper.PrepareClientRequest(attachedRequest, 1, 1, 0);
                    reply      = ActiveManagerGenericRpcHelper.RunRpcAndGetReply <RpcKillServiceImpl.Reply>(requestInfo, serverName, timeoutInMSec);
                    isSucceded = reply.IsSucceeded;
                });
                flag = false;
            }
            finally
            {
                if (isSucceded)
                {
                    ReplayCrimsonEvents.ServiceKillRequestSucceeded.Log <string, string, string>(serviceName, serverName, reply.ToString());
                }
                else
                {
                    string text = "Unknown";
                    if (ex != null)
                    {
                        text = string.Format("Error: {0}", ex.Message);
                    }
                    else if (reply != null)
                    {
                        if (reply.IsThrottled)
                        {
                            text = "Throttled";
                        }
                        else if (reply.IsSkippedDueToTimeCheck)
                        {
                            text = "SkippedDueToTimeCheck";
                        }
                        else if (reply.IsSkippedDueToRegistryOverride)
                        {
                            text = "SkippedDueToRegistryOverride";
                        }
                    }
                    ReplayCrimsonEvents.ServiceKillRequestFailed.Log <string, string, bool, string, bool, string>(serviceName, serverName, reply != null && reply.IsThrottled, text, flag, (reply != null) ? reply.ToString() : "<null>");
                }
            }
            return(reply);
        }