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

            if (!_methods.TryGetValue(ctx.MethodName, out method))
            {
                ctx.ReturnError(RpcErrorCode.MethodNotFound, null);
                return;
            }
            else
            {
                method.Call(ctx);
            }
        }
Exemplo n.º 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();
                }
            }
        }
Exemplo n.º 4
0
 public void ReturnError(RpcErrorCode errCode, Exception ex)
 {
     _innerCtx.ReturnError(errCode, ex);
 }