public virtual void DoPosts() { BufferedReaderMonitor firstReader; lock (this) { if (this.consumed) { return; } this.consumed = true; firstReader = this.firstReader; } if (firstReader != null) { Stream stream; try { stream = this.DoHTTP(true); } catch (IOException exception) { streamLogger.Error("Error in batch operation: " + exception.Message); this.Abort(exception); return; } catch (WebException exception2) { streamLogger.Error("Error in batch operation: " + exception2.Message); this.Abort(exception2); return; } MyReader answer = new MyReader(new StreamReader(stream, Encoding.UTF8)); firstReader.SetReader(answer); } }
public virtual BufferedReaderMonitor AddCall(IDictionary parameters) { lock (this) { if (this.consumed) { throw new SubscrException("Illegal use of a batch"); } if (!this.AddLine(parameters, this.limit)) { return null; } BufferedReaderMonitor monitor = new BufferedReaderMonitor(); if (this.lastReader == null) { this.firstReader = monitor; } else { this.lastReader.Next = monitor; } this.lastReader = monitor; return monitor; } }
public virtual BufferedReaderMonitor AddCall(Hashtable parameters) { lock (this) { if (this.consumed) { throw new SubscrException("Illegal use of a batch"); } if (!this.AddLine(parameters, this.limit)) { return(null); } BufferedReaderMonitor monitor = new BufferedReaderMonitor(); if (this.lastReader == null) { this.firstReader = monitor; } else { this.lastReader.Next = monitor; } this.lastReader = monitor; return(monitor); } }
public virtual void DoPosts() { BufferedReaderMonitor firstReader; lock (this) { if (this.consumed) { return; } this.consumed = true; firstReader = this.firstReader; } if (firstReader != null) { Stream responseStream; IOException exception; try { HttpWebRequest request = this.SendPost(); WebResponse response = null; try { response = request.GetResponse(); responseStream = response.GetResponseStream(); } catch (IOException exception1) { exception = exception1; try { response.Close(); } catch (Exception) { } throw exception; } } catch (IOException exception4) { exception = exception4; streamLogger.Error("Error in batch operation: " + exception.Message); this.Abort(exception); return; } catch (WebException exception2) { streamLogger.Error("Error in batch operation: " + exception2.Message); this.Abort(exception2); return; } MyReader answer = new MyReader(new StreamReader(responseStream, Encoding.Default)); firstReader.SetReader(answer); } }
public virtual void Abort(Exception error) { BufferedReaderMonitor firstReader; lock (this) { if (this.consumed) { } this.consumed = true; firstReader = this.firstReader; } if (firstReader != null) { firstReader.Error = error; } }