// Token: 0x060001A5 RID: 421 RVA: 0x00008FA8 File Offset: 0x000071A8 private ICancelableAsyncResult BeginWrapper(string methodName, CancelableAsyncCallback asyncCallback, object asyncState, bool rundownContextOnFailure, Func <NspiContext, NspiDispatchTask> beginDelegate, Func <NspiContext> contextFactory) { int contextHandle = 0; ICancelableAsyncResult asyncResult = null; NspiAsyncDispatch.ConditionalExceptionWrapper(ExTraceGlobals.NspiTracer.IsTraceEnabled(TraceType.DebugTrace), delegate { bool flag = false; FailureAsyncResult <NspiStatus> failureAsyncResult = null; try { this.CheckShuttingDown(); try { using (DisposeGuard disposeGuard = default(DisposeGuard)) { NspiContext nspiContext = contextFactory(); contextHandle = ((nspiContext != null) ? nspiContext.ContextHandle : 0); NspiDispatchTask nspiDispatchTask = beginDelegate(nspiContext); disposeGuard.Add <NspiDispatchTask>(nspiDispatchTask); asyncResult = nspiDispatchTask.AsyncResult; this.SubmitTask(nspiDispatchTask); disposeGuard.Success(); } flag = true; } catch (FailRpcException ex) { failureAsyncResult = new FailureAsyncResult <NspiStatus>((NspiStatus)ex.ErrorCode, new IntPtr(contextHandle), ex, asyncCallback, asyncState); asyncResult = failureAsyncResult; } catch (NspiException ex2) { failureAsyncResult = new FailureAsyncResult <NspiStatus>(ex2.Status, new IntPtr(contextHandle), ex2, asyncCallback, asyncState); asyncResult = failureAsyncResult; } if (failureAsyncResult != null && !ThreadPool.QueueUserWorkItem(NspiAsyncDispatch.FailureWaitCallback, failureAsyncResult)) { failureAsyncResult.InvokeCallback(); } ExTraceGlobals.NspiTracer.TraceDebug <string, int>(0, 0L, "{0} succeeded. ContextHandle={1}", methodName, contextHandle); } finally { if (!flag && rundownContextOnFailure && contextHandle != 0) { this.ContextHandleRundown(new IntPtr(contextHandle)); } } }, delegate(Exception exception) { ExTraceGlobals.NspiTracer.TraceDebug <string, int, Exception>(0, 0L, "{0} failed. ContextHandle={1}, Exception={2}.", methodName, contextHandle, exception); }); return(asyncResult); }
// Token: 0x0600019D RID: 413 RVA: 0x00008B6C File Offset: 0x00006D6C public void ContextHandleRundown(IntPtr contextHandle) { if (contextHandle == IntPtr.Zero) { return; } if (!this.isShuttingDown) { NspiAsyncDispatch.ExecuteAndIgnore("ContextHandleRundown", delegate { NspiContext nspiContext = null; using (DisposeGuard disposeGuard = default(DisposeGuard)) { if (ClientContextCache.TryGetContext(contextHandle.ToInt32(), out nspiContext)) { disposeGuard.Add <NspiContext>(nspiContext); ClientContextCache.DeleteContext(contextHandle.ToInt32()); nspiContext.Unbind(true); } } }); } }
// Token: 0x060001A1 RID: 417 RVA: 0x00008C50 File Offset: 0x00006E50 private static void ExecuteAndIgnore(string methodName, Action executeDelegate) { try { NspiAsyncDispatch.ConditionalExceptionWrapper(ExTraceGlobals.NspiTracer.IsTraceEnabled(TraceType.DebugTrace), delegate { executeDelegate(); }, delegate(Exception exception) { ExTraceGlobals.NspiTracer.TraceDebug <string, Exception>(0, 0L, "{0} failed. Exception={1}.", methodName, exception); }); } catch (RpcException) { } catch (ADTransientException) { } catch (ADOperationException) { } catch (DataValidationException) { } catch (StoragePermanentException) { } catch (StorageTransientException) { } catch (NspiException) { } catch (OutOfMemoryException) { } }
// Token: 0x060001A7 RID: 423 RVA: 0x00009234 File Offset: 0x00007434 private NspiStatus EndWrapper(string methodName, ICancelableAsyncResult asyncResult, bool rundownContextOnFailure, Func <NspiDispatchTask, NspiStatus> endDelegate) { int contextHandle = 0; NspiStatus nspiStatus = NspiStatus.Success; NspiAsyncDispatch.ConditionalExceptionWrapper(ExTraceGlobals.NspiTracer.IsTraceEnabled(TraceType.DebugTrace), delegate { bool flag = false; try { DispatchTaskAsyncResult dispatchTaskAsyncResult = asyncResult as DispatchTaskAsyncResult; if (dispatchTaskAsyncResult != null) { NspiDispatchTask nspiDispatchTask = (NspiDispatchTask)dispatchTaskAsyncResult.DispatchTask; contextHandle = nspiDispatchTask.ContextHandle; using (DisposeGuard disposeGuard = default(DisposeGuard)) { disposeGuard.Add <NspiDispatchTask>(nspiDispatchTask); try { nspiStatus = endDelegate(nspiDispatchTask); } finally { if (nspiDispatchTask.IsContextRundown && contextHandle != 0) { this.ContextHandleRundown(new IntPtr(contextHandle)); contextHandle = 0; } } } ExTraceGlobals.NspiTracer.TraceDebug <string, int, NspiStatus>(0, 0L, "{0} succeeded. ContextHandle={1} NspiStatus={2}.", methodName, contextHandle, nspiStatus); flag = true; } else { FailureAsyncResult <NspiStatus> failureAsyncResult = asyncResult as FailureAsyncResult <NspiStatus>; if (failureAsyncResult == null) { throw new InvalidOperationException(string.Format("Invalid IAsyncResult encountered; {0}", asyncResult)); } nspiStatus = failureAsyncResult.ErrorCode; ExTraceGlobals.NspiTracer.TraceDebug(0, 0L, "{0} failed. ContextHandle={1} NspiStatus={2}. Exception={3}.", new object[] { methodName, failureAsyncResult.ContextHandle.ToInt32(), nspiStatus, failureAsyncResult.Exception }); } } finally { if (!flag && rundownContextOnFailure && contextHandle != 0) { this.ContextHandleRundown(new IntPtr(contextHandle)); } } }, delegate(Exception exception) { ExTraceGlobals.NspiTracer.TraceDebug <string, int, Exception>(0, 0L, "{0} failed. ContextHandle={1}, Exception={2}.", methodName, contextHandle, exception); }); return(nspiStatus); }