public void ProcessRequest(HttpContext context)
        {
            if (toplogyLoader == null)
            {
                lock (lockObject) {
                    if (toplogyLoader == null)
                    {
                        string path = context.Server.MapPath(context.Request.Url.AbsolutePath);

                        if (path.EndsWith("defaultHandle.ashx"))
                        {
                            path = path.Substring(0, path.Length - 18);
                        }

                        toplogyLoader = new TopologyLoader(path + "topology.txt", Encoding.UTF8, new TopologyParser());
                        rpcClient     = new RpcClient(toplogyLoader, new TimeoutSettings(500));
                        instance      = rpcClient.GetService <IProcessGoodDetail.IGoodManager>();
                    }
                }
            }

            string[] ids    = new string[] { randNumber.Next(1000).ToString(), randNumber.Next(10000).ToString() };
            string   result = instance.GetGoodDetail(ids, randNumber.Next(100), randNumber.Next(1000), "北京");

            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
        }
Exemple #2
0
        private static void RunTestData()
        {
            try {
                string[] ids    = new string[] { "12", "16" };
                string   result = instance.GetGoodDetail(ids, 1, 2, "北京");

                if (!string.IsNullOrEmpty(result))
                {
                    Interlocked.Increment(ref successCount);
                }
                else
                {
                    Interlocked.Increment(ref failCount);
                }

                //Console.WriteLine(string.Format("tid:{0} {1}", Thread.CurrentThread.ManagedThreadId, result));
            }
            catch {
                Interlocked.Increment(ref failCount);
            }
        }