bool TransactedBatchLoop() { if (null != this.transactedBatchContext) { if (this.transactedBatchContext.InDispatch) { this.transactedBatchContext.ForceRollback(); this.transactedBatchContext.InDispatch = false; } if (!this.transactedBatchContext.IsActive) { if (!this.isMainTransactedBatchHandler) { return false; } this.transactedBatchContext = null; } } if (null == this.transactedBatchContext) { try { this.receiver.WaitForMessage(); } catch (Exception ex) { if (Fx.IsFatal(ex)) { throw; } if (!this.HandleError(ex)) { throw; } } this.transactedBatchContext = this.sharedTransactedBatchContext.CreateTransactedBatchContext(); } OperationContext existingOperationContext = OperationContext.Current; try { OperationContext currentOperationContext = new OperationContext(this.host); OperationContext.Current = currentOperationContext; RequestContext request; while (this.transactedBatchContext.IsActive) { this.requestInfo.Cleanup(); bool valid = TryTransactionalReceive(this.transactedBatchContext.Transaction, out request); if (!valid) { if (this.IsOpen) { this.transactedBatchContext.ForceCommit(); return true; } else { this.transactedBatchContext.ForceRollback(); return false; } } if (null == request) { this.transactedBatchContext.ForceRollback(); return false; } TransactionMessageProperty.Set(this.transactedBatchContext.Transaction, request.RequestMessage); this.transactedBatchContext.InDispatch = true; if (!HandleRequest(request, currentOperationContext)) { return false; } if (this.transactedBatchContext.InDispatch) { this.transactedBatchContext.ForceRollback(); this.transactedBatchContext.InDispatch = false; return true; } if (!TryAcquirePump()) { Fx.Assert("System.ServiceModel.Dispatcher.ChannelHandler.TransactedBatchLoop(): (TryAcquiredPump returned false)"); return false; } currentOperationContext.Recycle(); } } finally { OperationContext.Current = existingOperationContext; } return true; }
bool TransactedLoop() { try { this.receiver.WaitForMessage(); } catch (Exception ex) { if (Fx.IsFatal(ex)) { throw; } if (!this.HandleError(ex)) { throw; } } RequestContext request; Transaction tx = CreateOrGetAttachedTransaction(); OperationContext existingOperationContext = OperationContext.Current; try { OperationContext currentOperationContext = new OperationContext(this.host); OperationContext.Current = currentOperationContext; for (;;) { this.requestInfo.Cleanup(); bool received = TryTransactionalReceive(tx, out request); if (!received) { return IsOpen; } if (null == request) { return false; } TransactionMessageProperty.Set(tx, request.RequestMessage); if (!HandleRequest(request, currentOperationContext)) { return false; } if (!TryAcquirePump()) { return false; } tx = CreateOrGetAttachedTransaction(); currentOperationContext.Recycle(); } } finally { OperationContext.Current = existingOperationContext; } }
void SyncMessagePump() { OperationContext existingOperationContext = OperationContext.Current; try { OperationContext currentOperationContext = new OperationContext(this.host); OperationContext.Current = currentOperationContext; for (;;) { RequestContext request; this.requestInfo.Cleanup(); while (!TryReceive(TimeSpan.MaxValue, out request)) { } if (!HandleRequest(request, currentOperationContext)) { break; } if (!TryAcquirePump()) { break; } currentOperationContext.Recycle(); } } finally { OperationContext.Current = existingOperationContext; } }
private void SyncMessagePump() { OperationContext current = OperationContext.Current; try { RequestContext context3; OperationContext currentOperationContext = new OperationContext(this.host); OperationContext.Current = currentOperationContext; Label_0018: this.requestInfo.Cleanup(); while (!this.TryReceive(TimeSpan.MaxValue, out context3)) { } if (this.HandleRequest(context3, currentOperationContext) && this.TryAcquirePump()) { currentOperationContext.Recycle(); goto Label_0018; } } finally { OperationContext.Current = current; } }
private bool TransactedLoop() { bool flag2; try { this.receiver.WaitForMessage(); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } if (!this.HandleError(exception)) { throw; } } Transaction tx = this.CreateOrGetAttachedTransaction(); OperationContext current = OperationContext.Current; try { RequestContext context; OperationContext currentOperationContext = new OperationContext(this.host); OperationContext.Current = currentOperationContext; Label_0046: this.requestInfo.Cleanup(); if (!this.TryTransactionalReceive(tx, out context)) { return this.IsOpen; } if (context == null) { return false; } TransactionMessageProperty.Set(tx, context.RequestMessage); if (!this.HandleRequest(context, currentOperationContext)) { return false; } if (!this.TryAcquirePump()) { flag2 = false; } else { tx = this.CreateOrGetAttachedTransaction(); currentOperationContext.Recycle(); goto Label_0046; } } finally { OperationContext.Current = current; } return flag2; }
private bool TransactedBatchLoop() { if (this.transactedBatchContext != null) { if (this.transactedBatchContext.InDispatch) { this.transactedBatchContext.ForceRollback(); this.transactedBatchContext.InDispatch = false; } if (!this.transactedBatchContext.IsActive) { if (!this.isMainTransactedBatchHandler) { return false; } this.transactedBatchContext = null; } } if (this.transactedBatchContext == null) { try { this.receiver.WaitForMessage(); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } if (!this.HandleError(exception)) { throw; } } this.transactedBatchContext = this.sharedTransactedBatchContext.CreateTransactedBatchContext(); } OperationContext current = OperationContext.Current; try { OperationContext currentOperationContext = new OperationContext(this.host); OperationContext.Current = currentOperationContext; while (this.transactedBatchContext.IsActive) { RequestContext context3; this.requestInfo.Cleanup(); if (!this.TryTransactionalReceive(this.transactedBatchContext.Transaction, out context3)) { if (this.IsOpen) { this.transactedBatchContext.ForceCommit(); return true; } this.transactedBatchContext.ForceRollback(); return false; } if (context3 == null) { this.transactedBatchContext.ForceRollback(); return false; } TransactionMessageProperty.Set(this.transactedBatchContext.Transaction, context3.RequestMessage); this.transactedBatchContext.InDispatch = true; if (!this.HandleRequest(context3, currentOperationContext)) { return false; } if (this.transactedBatchContext.InDispatch) { this.transactedBatchContext.ForceRollback(); this.transactedBatchContext.InDispatch = false; return true; } if (!this.TryAcquirePump()) { return false; } currentOperationContext.Recycle(); } } finally { OperationContext.Current = current; } return true; }