Пример #1
0
 internal virtual void AbortBatch()
 {
     lock (this)
     {
         if (this.batchingProvider != null)
         {
             this.batchingProvider.Abort(new SubscrException("requests batch aborted"));
             this.batchingProvider = null;
         }
     }
 }
Пример #2
0
 internal virtual void AbortBatch()
 {
     lock (this)
     {
         if (this.batchingProvider != null)
         {
             this.batchingProvider.Abort(new SubscrException("requests batch aborted"));
             this.batchingProvider = null;
         }
     }
 }
Пример #3
0
 internal virtual void StartBatch(string controlUrl)
 {
     lock (this)
     {
         if (this.batchingProvider != null)
         {
             this.batchingProvider.Abort(new SubscrException("requests batch discarded"));
         }
         this.batchingProvider = new BatchingHttpProvider(controlUrl, this.limit);
     }
 }
Пример #4
0
 internal virtual void CloseBatch()
 {
     BatchingHttpProvider batchingProvider;
     lock (this)
     {
         batchingProvider = this.batchingProvider;
         this.batchingProvider = null;
     }
     if (batchingProvider != null)
     {
         DoAsyncPost(batchingProvider);
     }
 }
Пример #5
0
        internal virtual void CloseBatch()
        {
            BatchingHttpProvider batchingProvider;

            lock (this)
            {
                batchingProvider      = this.batchingProvider;
                this.batchingProvider = null;
            }
            if (batchingProvider != null)
            {
                DoAsyncPost(batchingProvider);
            }
        }
Пример #6
0
 public void SetReader(BatchingHttpProvider.MyReader answer)
 {
     lock (this)
     {
         this.answer = answer;
         answer.Master = this;
         Monitor.Pulse(this);
     }
 }
Пример #7
0
 internal virtual StreamReader GetAnswer(string controlUrl, IDictionary parameters, BatchMonitor batch)
 {
     BatchingHttpProvider batchToClose = null;
     BatchingHttpProvider.BufferedReaderMonitor monitor = null;
     bool flag = false;
     lock (batch)
     {
         lock (this)
         {
             if (!batch.Filled)
             {
                 batch.UseOne();
                 if (this.batchingProvider != null)
                 {
                     protLogger.Info("Batching control request");
                     if (protLogger.IsDebugEnabled)
                     {
                         protLogger.Debug("Control params: " + CollectionsSupport.ToString(parameters));
                     }
                     monitor = this.batchingProvider.AddCall(parameters);
                     if (monitor != null)
                     {
                         if (batch.Filled)
                         {
                             batchToClose = this.batchingProvider;
                             this.batchingProvider = null;
                         }
                     }
                     else if (this.batchingProvider.Empty)
                     {
                         protLogger.Info("Batching failed; trying without batch");
                         if (batch.Filled)
                         {
                             this.batchingProvider = null;
                         }
                     }
                     else
                     {
                         protLogger.Info("Batching failed; trying a new batch");
                         batchToClose = this.batchingProvider;
                         batch.Expand(1);
                         this.batchingProvider = new BatchingHttpProvider(controlUrl, this.limit);
                         flag = true;
                     }
                 }
             }
             else if (this.batchingProvider != null)
             {
                 this.batchingProvider.Abort(new SubscrException("wrong requests batch"));
                 this.batchingProvider = null;
             }
         }
     }
     if (batchToClose != null)
     {
         DoAsyncPost(batchToClose);
     }
     if (monitor != null)
     {
         return monitor.GetReader();
     }
     if (flag)
     {
         return this.GetAnswer(controlUrl, parameters, batch);
     }
     return this.GetNotBatchedAnswer(controlUrl, parameters);
 }
Пример #8
0
 private static void DoAsyncPost(BatchingHttpProvider batchToClose)
 {
     new AnonymousClassThread(batchToClose).Start();
 }
Пример #9
0
 public AnonymousClassThread(BatchingHttpProvider batchToClose)
 {
     this.batchToClose = batchToClose;
 }
Пример #10
0
 internal virtual void StartBatch(string controlUrl)
 {
     lock (this)
     {
         if (this.batchingProvider != null)
         {
             this.batchingProvider.Abort(new SubscrException("requests batch discarded"));
         }
         this.batchingProvider = new BatchingHttpProvider(controlUrl, this.limit);
     }
 }
Пример #11
0
        internal virtual StreamReader GetAnswer(string controlUrl, Hashtable parameters, BatchMonitor batch)
        {
            BatchingHttpProvider batchToClose = null;

            BatchingHttpProvider.BufferedReaderMonitor monitor = null;
            bool flag = false;

            lock (batch)
            {
                lock (this)
                {
                    if (!batch.Filled)
                    {
                        batch.UseOne();
                        if (this.batchingProvider != null)
                        {
                            protLogger.Info("Batching control request");
                            if (protLogger.IsDebugEnabled)
                            {
                                protLogger.Debug("Control params: " + CollectionsSupport.ToString(parameters));
                            }
                            monitor = this.batchingProvider.AddCall(parameters);
                            if (monitor != null)
                            {
                                if (batch.Filled)
                                {
                                    batchToClose          = this.batchingProvider;
                                    this.batchingProvider = null;
                                }
                            }
                            else if (this.batchingProvider.Empty)
                            {
                                protLogger.Info("Batching failed; trying without batch");
                                if (batch.Filled)
                                {
                                    this.batchingProvider = null;
                                }
                            }
                            else
                            {
                                protLogger.Info("Batching failed; trying a new batch");
                                batchToClose = this.batchingProvider;
                                batch.Expand(1);
                                this.batchingProvider = new BatchingHttpProvider(controlUrl, this.limit);
                                flag = true;
                            }
                        }
                    }
                    else if (this.batchingProvider != null)
                    {
                        this.batchingProvider.Abort(new SubscrException("wrong requests batch"));
                        this.batchingProvider = null;
                    }
                }
            }
            if (batchToClose != null)
            {
                DoAsyncPost(batchToClose);
            }
            if (monitor != null)
            {
                return(monitor.GetReader());
            }
            if (flag)
            {
                return(this.GetAnswer(controlUrl, parameters, batch));
            }
            return(this.GetNotBatchedAnswer(controlUrl, parameters));
        }
Пример #12
0
 private static void DoAsyncPost(BatchingHttpProvider batchToClose)
 {
     new AnonymousClassThread(batchToClose).Start();
 }
Пример #13
0
 public AnonymousClassThread(BatchingHttpProvider batchToClose)
 {
     this.batchToClose = batchToClose;
 }