示例#1
0
 public override IEnumerable <object> Run()
 {
     if (base.Operation.target.isCategoric)
     {
         yield return(null);
     }
     if (base.Operation.target.isNumeric)
     {
         if (!base.Operation.target.serviceID.Equals(this.service.ID))
         {
             yield return(null);
         }
         else
         {
             if (base.Operation.enable)
             {
                 OperationProxy.EnableTimeReport();
             }
             else
             {
                 this.service.ClearOperationTimeReport();
                 OperationProxy.DisableTimeReport();
             }
             yield return(null);
         }
     }
     yield break;
 }
示例#2
0
 private void Proxy_ProcessorAttached(OperationProxy proxy, OperationProcessor processor)
 {
     if (processor is EntityProcessor)
     {
         (processor as EntityProcessor).Connection = this;
     }
 }
示例#3
0
 private void Proxy_ProcessorDisposed(OperationProxy proxy)
 {
     if (OperationProxy.IsTimeReportEnabled)
     {
         string text = proxy.RecentOperationName;
         if (text != "")
         {
             if (proxy.IsRequesting)
             {
                 text += "\tout";
             }
             else
             {
                 text += "\tin";
             }
             OperationTimeReportElement operationTimeReportElement;
             if (!this.OperationTimeReport.TryGetValue(text, out operationTimeReportElement))
             {
                 operationTimeReportElement = new OperationTimeReportElement();
             }
             operationTimeReportElement.Add(proxy.TimerResult);
             this.OperationTimeReport[text] = operationTimeReportElement;
         }
     }
     if (this.Proxy != null)
     {
         this.Proxy.Dispose();
         this.Proxy = null;
     }
     if (this.State == EntityConnection.ConnectionState.OutOfEntity)
     {
         this.DoClose();
         return;
     }
     if (this.OperationQueue.Count > 0)
     {
         this.RequestOperation(this.OperationQueue.Dequeue());
         return;
     }
     if (this.IsClosing)
     {
         if (this.State == EntityConnection.ConnectionState.Bound)
         {
             this.SendMessage(new RequestClose());
             return;
         }
         this.DoClose();
     }
 }
示例#4
0
        internal OperationProxy MakeProxy(Peer peer, Pipe pipe)
        {
            OperationProxy proxy = new OperationProxy(delegate(object msg)
            {
                if (!pipe.IsClosed)
                {
                    pipe.SendObject(msg);
                    return;
                }
                if (Log <Service> .Logger.IsInfoEnabled)
                {
                    Log <Service> .Logger.InfoFormat("try send to closed pipe : {0}", msg);
                }
            }, new Func <Type, Func <Operation, OperationProcessor> >(this.FindProcessor));

            pipe.MessageReceived += delegate(object msg)
            {
                proxy.ProcessMessage(msg);
            };
            pipe.Closed += delegate(Pipe p)
            {
                proxy.Dispose();
            };
            proxy.ProcessorDisposed += delegate(OperationProxy _)
            {
                proxy.Dispose();
                pipe.Close();
            };
            proxy.ProcessorAttached += delegate(OperationProxy _, OperationProcessor processor)
            {
                pipe.Tag = processor.ToString();
            };
            if (this.OnOpenProxy != null)
            {
                this.OnOpenProxy(peer, pipe, proxy);
            }
            return(proxy);
        }
示例#5
0
 private void Proxy_ProcessorAttached <TOperation, TEntity>(OperationProxy proxy, EntityProcessor <TOperation, TEntity> processor) where TOperation : Operation where TEntity : class
 {
     processor.Connection = this;
 }