// 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);
            }
        }
        public override void OnTransactionStart(RpcServerContext ctx)
        {
            RpcServiceMethod method;

            if (!_methods.TryGetValue(ctx.MethodName, out method))
            {
                ctx.ReturnError(RpcErrorCode.MethodNotFound, null);
                return;
            }
            else
            {
                method.Call(ctx);
            }
        }
Exemple #3
0
        public override void OnTransactionStart(RpcServerContext context)
        {
            RpcServiceMethod method;

            if (!_methods.TryGetValue(context.MethodName, out method))
            {
                throw new RpcException("TransactionStart", "", RpcErrorCode.MethodNotFound, null);
            }
            else
            {
                try {
                    method.RatePerSecond.Increment();
                    method.TotalCount.Increment();
                    method.Concurrent.Increment();
                    method.Method.Invoke(_serviceObj, new object[] { context });
                } catch (Exception ex) {
                    context.ReturnError(RpcErrorCode.ServerError, ex);
                    method.TotalFailed.Increment();
                } finally {
                    method.Concurrent.Decrement();
                }
            }
        }
Exemple #4
0
 public void ReturnError(RpcErrorCode errCode, Exception ex)
 {
     _innerCtx.ReturnError(errCode, ex);
 }