static bool HandleEndComplete(IAsyncResult result) { ReceiveContextAsyncResult thisPtr = (ReceiveContextAsyncResult)result.AsyncState; thisPtr.receiveContext.EndComplete(result); return(true); }
static void OnComplete(object parameter) { ReceiveContextAsyncResult result = parameter as ReceiveContextAsyncResult; Exception completionException = null; Transaction savedTransaction = null; try { // set the current transaction object for this worker thread as this operation could // have been scheduled by another worker thread. We do not want to complete in // worker threads ambient transaction. associatedTransaction can be null. savedTransaction = Transaction.Current; Transaction.Current = result.associatedTransaction; result.receiver.OnComplete(result.timeoutHelper.RemainingTime()); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } completionException = e; } finally { Transaction.Current = savedTransaction; } result.Complete(false, completionException); }
public static IAsyncResult CreateAbandon(HttpAcknowledgementReceiveContext receiver, TimeSpan timeout, AsyncCallback callback, object state) { IAsyncResult receiveContextAsyncResult = new ReceiveContextAsyncResult(receiver, timeout, callback, state); ThreadPool.QueueUserWorkItem(onAbandon, receiveContextAsyncResult); return(receiveContextAsyncResult); }
private bool ProcessReceiveContext() { if (this.receiveContext == null) { return(true); } if (handleEndProcessReceiveContext == null) { handleEndProcessReceiveContext = new AsyncResult.AsyncCompletion(WorkflowOperationContext.HandleEndProcessReceiveContext); } IAsyncResult result = ReceiveContextAsyncResult.BeginProcessReceiveContext(this, this.receiveContext, base.PrepareAsyncCompletion(handleEndProcessReceiveContext), this); return(base.SyncContinue(result)); }
bool ProcessReceiveContext() { if (this.receiveContext != null) { if (handleEndProcessReceiveContext == null) { handleEndProcessReceiveContext = new AsyncCompletion(HandleEndProcessReceiveContext); } IAsyncResult nextResult = ReceiveContextAsyncResult.BeginProcessReceiveContext(this, this.receiveContext, PrepareAsyncCompletion(handleEndProcessReceiveContext), this); return(SyncContinue(nextResult)); } return(true); }
static void OnAbandon(object parameter) { ReceiveContextAsyncResult result = parameter as ReceiveContextAsyncResult; Exception completionException = null; try { result.receiver.OnAbandon(result.timeoutHelper.RemainingTime()); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } completionException = e; } result.Complete(false, completionException); }
protected override IAsyncResult OnBeginComplete(TimeSpan timeout, AsyncCallback callback, object state) { return(ReceiveContextAsyncResult.CreateComplete(this, timeout, callback, state)); }
protected override void OnEndAbandon(IAsyncResult result) { ReceiveContextAsyncResult.End(result); }
protected override void OnEndComplete(IAsyncResult result) { ReceiveContextAsyncResult.End(result); }
public static void EndProcessReceiveContext(IAsyncResult result) { ReceiveContextAsyncResult.End(result); }
static bool HandleEndProcessReceiveContext(IAsyncResult result) { ReceiveContextAsyncResult.EndProcessReceiveContext(result); return(true); }
static void OnAbandon(object parameter) { ReceiveContextAsyncResult result = parameter as ReceiveContextAsyncResult; result.receiver.OnAbandon(result.timeoutHelper.RemainingTime()); }
public static IAsyncResult CreateComplete(HttpAcknowledgementReceiveContext receiver, TimeSpan timeout, AsyncCallback callback, object state) { IAsyncResult receiveContextAsyncResult = new ReceiveContextAsyncResult(receiver, timeout, callback, state); ThreadPool.QueueUserWorkItem(onComplete, receiveContextAsyncResult); return receiveContextAsyncResult; }