Ejemplo n.º 1
0
 internal RpcBatchServerContext(RpcServerContext ctx)
 {
     _innerCtx  = ctx;
     _requests  = ctx.GetArgs <RpcBatchRequest[]>();
     _count     = _requests.Length;
     _responses = new RpcBatchResponse[_count];
 }
Ejemplo n.º 2
0
        private static void DetectProc(RpcServerContext context)
        {
            throw new NotImplementedException();
            //switch (context.MethodName) {

            //}
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
        public override void OnTransactionStart(RpcServerContext context)
        {
            //if (context.ContextUri) {
            RpcConnection        conn = null;
            RpcClientTransaction tx   = conn.CreateTransaction(context.Request);

            tx.SendRequest(
                delegate() {
                context.Return(tx.Response);
            },
                -1

                );
            //}
        }
Ejemplo n.º 6
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();
                }
            }
        }
Ejemplo n.º 7
0
 public abstract void OnTransactionStart(RpcServerContext context);
Ejemplo n.º 8
0
 public override void OnTransactionStart(RpcServerContext context)
 {
     _serviceProc(context);
 }