// Token: 0x06001CBF RID: 7359 RVA: 0x000A5B36 File Offset: 0x000A3D36 private void UpdatePerformanceCounterBeforeConversion(TranscodingParameters parameters) { ExTraceGlobals.TranscodingTracer.TraceDebug <string>((long)this.GetHashCode(), "Transaction {0} start to transcoding.", parameters.DocumentId); OwaSingleCounters.ActiveConversions.Increment(); parameters.Stopwatch.Reset(); parameters.Stopwatch.Start(); }
// Token: 0x06001CC0 RID: 7360 RVA: 0x000A5B78 File Offset: 0x000A3D78 private void UpdatePerformanceCounterAfterConversion(TranscodingParameters parameters) { ExTraceGlobals.TranscodingTracer.TraceDebug <string>((long)this.GetHashCode(), "Transaction {0} finished.", parameters.DocumentId); parameters.Stopwatch.Stop(); long num = Interlocked.Add(ref this.totalConversionTime, (long)((int)parameters.Stopwatch.ElapsedMilliseconds)); long num2 = Interlocked.Increment(ref this.totalConversionCount); OwaSingleCounters.AverageConvertingTime.RawValue = (long)((int)(num / num2)); OwaSingleCounters.ActiveConversions.Decrement(); }
// Token: 0x06001CBE RID: 7358 RVA: 0x000A5AB0 File Offset: 0x000A3CB0 private void UpdatePerformanceCounterAfterLeftQueue(TranscodingParameters parameters) { if (parameters != null && !parameters.IsLeftQueueHandled) { ExTraceGlobals.TranscodingTracer.TraceDebug <string>((long)this.GetHashCode(), "Transaction {0} left the queue.", parameters.DocumentId); OwaSingleCounters.QueuedConversionRequests.Decrement(); parameters.Stopwatch.Stop(); long num = (long)Interlocked.Add(ref this.totalQueuedTime, (int)parameters.Stopwatch.ElapsedMilliseconds); long num2 = (long)Interlocked.Increment(ref this.totalRequestCount); OwaSingleCounters.AverageConversionQueuingTime.RawValue = (long)((int)(num / num2)); parameters.IsLeftQueueHandled = true; } }
// Token: 0x06001CBD RID: 7357 RVA: 0x000A5A7C File Offset: 0x000A3C7C private void UpdatePerformanceCounterBeforeEnterQueue(TranscodingParameters parameters) { ExTraceGlobals.TranscodingTracer.TraceDebug <string>((long)this.GetHashCode(), "Transaction {0} enter the queue.", parameters.DocumentId); OwaSingleCounters.QueuedConversionRequests.Increment(); parameters.Stopwatch.Start(); }
// Token: 0x06001CBC RID: 7356 RVA: 0x000A5708 File Offset: 0x000A3908 private void TranscodeWorker(string docId, string sessionId, Stream inputStream, string sourceDocType, int currentPageNumber, out int totalPageNumber, HttpResponse response) { ExTraceGlobals.TranscodingTracer.TraceDebug <string>((long)this.GetHashCode(), "Start to process document {0}", docId); if (this.blockList.CheckItem(docId)) { ExTraceGlobals.TranscodingTracer.TraceDebug <string>((long)this.GetHashCode(), "Document {0} has been blocked", docId); OwaSingleCounters.TotalRejectedConversions.Increment(); OwaSingleCounters.TotalConversions.Increment(); throw new TranscodingUnconvertibleFileException("Input document has been in block list.", null, this); } TranscodingParameters transcodingParameters = null; bool flag = false; bool flag2 = false; try { transcodingParameters = new TranscodingParameters(sessionId, docId, inputStream, sourceDocType, currentPageNumber); this.UpdatePerformanceCounterBeforeEnterQueue(transcodingParameters); flag = this.transcodingProcessManager.ExecuteRequest(transcodingParameters); } catch (COMException ex) { if (ex.ErrorCode == -2147023170) { this.blockList.AddNew(transcodingParameters.DocumentId); throw new TranscodingCrashException("Worker process crashes when doing convension", ex, this); } throw new TranscodingFatalFaultException("ComException thrown from transcoding service", ex, this); } catch (ComInterfaceInitializeException ex2) { ExTraceGlobals.TranscodingTracer.TraceDebug <string>((long)this.GetHashCode(), "Document {0} can not be transcoded because of server initialize failed.", docId); OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_TranscodingWorkerInitializationFailed, string.Empty, new object[] { ex2.Message }); throw new TranscodingFatalFaultException("Initizlie transcoding service failed.", ex2, this); } catch (ComProcessTimeoutException innerException) { flag2 = true; ExTraceGlobals.TranscodingTracer.TraceDebug <string>((long)this.GetHashCode(), "Document {0} can not be transcoded because it takes too long to convert.", docId); this.blockList.AddNew(docId); throw new TranscodingTimeoutException("Takes too long to convert " + docId, innerException, this); } catch (ComProcessBusyException innerException2) { flag2 = true; ExTraceGlobals.TranscodingTracer.TraceDebug <string>((long)this.GetHashCode(), "Document {0} can not be transcoded because of server busy.", docId); throw new TranscodingServerBusyException("Server to busy to accept the request.", innerException2, this); } catch (ComProcessBeyondMemoryLimitException innerException3) { ExTraceGlobals.TranscodingTracer.TraceDebug <string>((long)this.GetHashCode(), "Document {0} can not be transcoded because of it causes transcodingservice consuming too much memory.", docId); this.blockList.AddNew(docId); throw new TranscodingUnconvertibleFileException("Document " + docId + " causes transcodingservice too memory to transcode it.", innerException3, this); } catch (UnauthorizedAccessException ex3) { ExTraceGlobals.TranscodingTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Document {0} can not be transcoded because of the cache folder cannot be accessed. Exception message: {1}", docId, ex3.Message); throw new TranscodingFatalFaultException(string.Format("Document {0} can not be transcoded because of the cache folder cannot be accessed", docId), ex3, this); } finally { OwaSingleCounters.TotalConvertingRequestsRate.IncrementBy((long)(transcodingParameters.SourceDocSize / 1024)); this.UpdatePerformanceCounterAfterLeftQueue(transcodingParameters); OwaSingleCounters.TotalConversions.Increment(); if (!flag || transcodingParameters == null || transcodingParameters.ErrorCode != TranscodeErrorCode.Succeeded) { if (flag2) { OwaSingleCounters.TotalTimeoutConversions.Increment(); } else { OwaSingleCounters.TotalErrorConversions.Increment(); } } } if (transcodingParameters.ErrorCode != TranscodeErrorCode.Succeeded) { this.HandleTranscoderErrorCode(transcodingParameters.ErrorCode); } OwaSingleCounters.SuccessfulConversionRequestRate.IncrementBy((long)(transcodingParameters.SourceDocSize / 1024)); totalPageNumber = transcodingParameters.TotalPageNumber; if (response != null) { this.cache.TransmitFile(sessionId, docId, transcodingParameters.RewrittenHtmlFileName, response); } }
// Token: 0x06001CBA RID: 7354 RVA: 0x000A541C File Offset: 0x000A361C private bool OnExecuteRequestDelegate(IComWorker <ITranscoder> worker, object requestParameters) { TranscodingParameters transcodingParameters = (TranscodingParameters)requestParameters; ITranscoder transcoder = null; try { transcoder = worker.Worker; } catch (ObjectDisposedException innerException) { throw new TranscodingFatalFaultException("Worker object has been disposed", innerException); } this.UpdatePerformanceCounterAfterLeftQueue(transcodingParameters); this.UpdatePerformanceCounterBeforeConversion(transcodingParameters); int totalPageNumber = 0; int num = 0; TranscodeErrorCode?transcodeErrorCode = null; string text = null; string text2 = null; bool result; try { try { ExTraceGlobals.TranscodingTracer.TraceDebug <string>((long)this.GetHashCode(), "Start to cache input document {0}", transcodingParameters.DocumentId); this.cache.CacheInputDocument(transcodingParameters.SessionId, transcodingParameters.DocumentId, transcodingParameters.SourceStream, out text, out text2); using (FileStream fileStream = File.Open(text, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { transcodingParameters.SourceDocSize = (int)fileStream.Length; } ExTraceGlobals.TranscodingTracer.TraceDebug <string>((long)this.GetHashCode(), "Start to transcode {0}", transcodingParameters.DocumentId); transcodeErrorCode = new TranscodeErrorCode?(transcoder.Convert(text, text2, transcodingParameters.SourceDocType, transcodingParameters.CurrentPageNumber, out totalPageNumber, out num)); ExTraceGlobals.TranscodingTracer.TraceDebug <string, TranscodeErrorCode?>((long)this.GetHashCode(), "Document {0} transcoding finished with return code {1}", transcodingParameters.DocumentId, transcodeErrorCode); transcodingParameters.TotalPageNumber = totalPageNumber; } finally { this.UpdatePerformanceCounterAfterConversion(transcodingParameters); transcodingParameters.ErrorCode = transcodeErrorCode; if (transcodeErrorCode == TranscodeErrorCode.Succeeded) { OwaSingleCounters.TotalConvertingResponseRate.IncrementBy((long)(num / 1024)); } string rewrittenHtmlFileName = null; if (!string.IsNullOrEmpty(text2)) { this.cache.NotifyTranscodingFinish(transcodingParameters.SessionId, transcodingParameters.DocumentId, Path.GetFileName(text2), out rewrittenHtmlFileName, transcodeErrorCode == TranscodeErrorCode.Succeeded); transcodingParameters.RewrittenHtmlFileName = rewrittenHtmlFileName; } } if (transcodeErrorCode == TranscodeErrorCode.Succeeded || transcodeErrorCode == TranscodeErrorCode.WrongFileTypeError || transcodeErrorCode == TranscodeErrorCode.InvalidPageNumberError) { result = true; } else { this.blockList.AddNew(transcodingParameters.DocumentId); result = false; } } catch (IOException ex) { ExTraceGlobals.TranscodingTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Document {0} can not be transcoded because of an IO error. Exception message: {1}", transcodingParameters.DocumentId, ex.Message); throw new TranscodingUnconvertibleFileException(string.Format("Document {0} can not be transcoded because of an IO error.", transcodingParameters.DocumentId), ex, this); } return(result); }