Exemplo n.º 1
0
        // NextVersion
        //public static void Start(string[] dlls)
        //{
        //    foreach (IRpcServerChannel channel in _channels) {
        //        channel.Start();
        //        _tracing.WarnFmt("RpcChannel<{0}> Started on {1}", channel.Protocol, channel.UrlPrefix);
        //    }
        //    if (_hasTransparent)
        //        RpcGetArgsHelper.Build(dlls);
        //}

        private static void TransactionStartCallback(IRpcServerTransaction trans)
        {
            RpcServerContext context = null;

            try {
                context = new RpcServerContext(trans);

                RpcServiceBase serviceBase;
                PerfCounter.InvokePerSec.Increment();
                PerfCounter.InvokeTotal.Increment();

                if (_services.TryGetValue(context.ServiceName, out serviceBase))
                {
                    serviceBase.OnTransactionStart(context);
                }
                else
                {
                    context.ReturnError(RpcErrorCode.ServiceNotFound, new Exception(context.ServiceName + " NotFound"));
                }
            } catch (RpcException ex) {
                context.ReturnError(ex.RpcCode, ex);
            } catch (Exception ex) {
                context.ReturnError(RpcErrorCode.ServerError, ex);
            }
        }
Exemplo n.º 2
0
        public RpcServerContext(IRpcServerTransaction trans)
        {
            _request     = trans.ReceiveRequestHeader();
            _trans       = trans;
            _hasReturned = 0;

            _observer = RpcObserverManager.GetServerItem(_request.Service, _request.Method, _request.FromService, _request.FromComputer);
            _watch    = new Stopwatch();
            _watch.Start();
            // _perfCounters.ConcurrentContext.Increment();
        }