Exemple #1
0
        public new Task <string> InvokeProcessorAsync(string channel, string router, string method, Dictionary <string, string> response)
        {
            /*
             * 采用复制品 发送请求。防止修改当前上下文对象Input
             */
            if (response.Equals(_input))
            {
                var responseReplica = new Dictionary <string, string>();
                foreach (var dic in response)
                {
                    responseReplica.Add(dic.Key, dic.Value);
                }
                return(InvokeEngine.InvokeProcessorAsync(channel, router, method, responseReplica));
            }

            if (!response.ContainsKey("TraceId"))
            {
                response.Add("TraceId", RequestString("TraceId"));
            }
            if (!response.ContainsKey("PreTraceId"))
            {
                response.Add("PreTraceId", RequestString("PreTraceId"));
            }
            if (!response.ContainsKey("TTL"))
            {
                response.Add("TTL", RequestString("TTL"));
            }
            if (!response.ContainsKey("GlobalTraceId"))
            {
                response.Add("GlobalTraceId", RequestString("GlobalTraceId"));
            }
            return(InvokeEngine.InvokeProcessorAsync(channel, router, method, response));
        }
Exemple #2
0
        private void EnterLock()
        {
            var response = new Dictionary <string, string>();

            response.Add("DLKey", _key);
            response.Add("TimeOut", _timeOut.ToString());
            response.Add("Owner", _owner);
            var rltStr = InvokeEngine.InvokeProcessor(channel, router, "EnterLock", response);
            var rlt    = Newtonsoft.Json.JsonConvert.DeserializeObject <ActionResult>(rltStr);

            if (!rlt.Status)
            {
                throw new DLockException("EnterLock Error:" + rlt.Msg);
            }
            _getLockStatus = true;
        }
Exemple #3
0
 private void DisposeLock()
 {
     try
     {
         if (_getLockStatus)
         {
             var response = new Dictionary <string, string>();
             response.Add("DLKey", _key);
             response.Add("Owner", _owner);
             InvokeEngine.InvokeProcessor(channel, router, "DisposeLock", response);
         }
     }
     catch (Exception)
     {
         //throw new DLockException("DisposeLock:" + e.Message);
     }
 }