// // WCF calls this if we return false from IsIdle. The job of this method is to call the // callback when the InstanceContext is ready to close. This allows you to keep an instance // alive as long as you want. // // When you call the callback, WCF will check again if there are attached channels or active // messages, and will call our IsIdle again. If there are no channels or messages and we // return true, WCF closes the InstanceContext. Otherwise, if there are channels or // messages, nothing happens--later when those channels/messages go away we will get another // round of IsIdle/NotifyIdle calls. // void IInstanceContextProvider.NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { AddressableInstanceContextInfo info = instanceContext.Extensions.Find <AddressableInstanceContextInfo>(); info.SetIdleCallback(callback); }
internal void SetIdleCallback(InstanceContextIdleCallback callback) { lock (this.ThisLock) { this.idleCallback = callback; this.CheckIdle(); } }
internal void CallIdleCallback(InstanceContextIdleCallback callback, InstanceContext instanceContext) { lock (this.ThisLock) { // Take the lock while WCF closes the InstanceContext. This prevents a new message // from picking up the dying InstanceContext. A message that comes in after we // acquire the lock will not find an InstanceContext in the table, and will create a // new one. If a new message came in before we took this lock and attached to the // instanceContext, this callback will be a no-op. This ensures that when the // close-on-idle actually happens, it happens under this lock. callback(instanceContext); } }
public void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { lock (thisLock) { ICustomLease customLease = instanceContext.Extensions.Find <ICustomLease>(); customLease.Callback = callback; isIdle = customLease.IsIdle; if (isIdle) { callback(instanceContext); } } }
public void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { lock (thisLock) { ICustomLease customLease = instanceContext.Extensions.Find<ICustomLease>(); customLease.Callback = callback; isIdle = customLease.IsIdle; if (isIdle) { callback(instanceContext); } } }
// -------------------------------------------------------------------- // The next 4 methods manage whether we know of anyone who is trying to use this // InstanceContext. // This calls the callback when the SetIdleCallback call and all DecrementBusyCount calls // have run. It ensures that the callback is called exactly once after a SetIdleCallback. // It assumes that we have locked ThisLock. void CheckIdle() { if ((this.busyCount == 0) && (this.idleCallback != null)) { InstanceContextIdleCallback callback = this.idleCallback; this.idleCallback = null; try { this.isIdle = true; this.parent.CallIdleCallback(callback, this.instanceContext); } finally { this.isIdle = false; } } }
public override void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { WorkflowDurableInstance workflowDurableInstance = instanceContext.Extensions.Find <WorkflowDurableInstance>(); if (workflowDurableInstance == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new InvalidOperationException( SR2.GetString( SR2.RequiredInstanceContextExtensionNotFound, typeof(WorkflowDurableInstance).Name))); } if (this.InstanceLifeTimeManager != null) { if (this.InstanceLifeTimeManager.IsInstanceInMemory(workflowDurableInstance.InstanceId)) { this.InstanceLifeTimeManager.NotifyWorkflowActivationComplete(workflowDurableInstance.InstanceId, Fx.ThunkCallback(new WaitCallback(this.OnWorkflowActivationCompleted)), new WorkflowActivationCompletedCallbackState ( workflowDurableInstance.InstanceId, instanceContext, callback), true); } else { if (base.IsIdle(instanceContext)) { callback(instanceContext); } else { base.NotifyIdle(callback, instanceContext); } } } else { base.NotifyIdle(callback, instanceContext); } }
private void CheckIdle() { if (this.busyCount == 0 && this.idleCallback != null) { InstanceContextIdleCallback callback = this.idleCallback; this.idleCallback = null; if (callback != null) { try { this.IsIdle = true; callback(this.instanceContext); } finally { this.IsIdle = false; } } } }
public void SetIdleCallback(InstanceContextIdleCallback callback) { this.idleCallback = callback; this.CheckIdle(); }
public override void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { }
public void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { //Empty }
public virtual void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { }
public void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { // FIXME: implement }
public void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { res.string_res += "NotifyIdle , "; res.AddCurrentOperationContextInfo(); }
void IInstanceContextProvider.NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { }
public override void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { WorkflowDurableInstance workflowDurableInstance = instanceContext.Extensions.Find<WorkflowDurableInstance>(); if (workflowDurableInstance == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new InvalidOperationException( SR2.GetString( SR2.RequiredInstanceContextExtensionNotFound, typeof(WorkflowDurableInstance).Name))); } if (this.InstanceLifeTimeManager != null) { if (this.InstanceLifeTimeManager.IsInstanceInMemory(workflowDurableInstance.InstanceId)) { this.InstanceLifeTimeManager.NotifyWorkflowActivationComplete(workflowDurableInstance.InstanceId, Fx.ThunkCallback(new WaitCallback(this.OnWorkflowActivationCompleted)), new WorkflowActivationCompletedCallbackState ( workflowDurableInstance.InstanceId, instanceContext, callback), true); } else { if (base.IsIdle(instanceContext)) { callback(instanceContext); } else { base.NotifyIdle(callback, instanceContext); } } } else { base.NotifyIdle(callback, instanceContext); } }
public WorkflowActivationCompletedCallbackState(Guid instanceId, InstanceContext instanceContext, InstanceContextIdleCallback callback) { this.instanceId = instanceId; this.instanceContext = instanceContext; this.instanceContextIdleCallback = callback; }
public void NotifyIdle(InstanceContextIdleCallback callback, System.ServiceModel.InstanceContext instanceContext) { }
public void NotifyIdle (InstanceContextIdleCallback callback, InstanceContext instanceContext) { // FIXME: implement }
public virtual void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException()); }
public void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { ColorConsole.WriteLine(ConsoleColor.Cyan, "{0}.{1}", this.GetType().Name, ReflectionUtil.GetMethodSignature(MethodBase.GetCurrentMethod())); this.inner.NotifyIdle(callback, instanceContext); }
public void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { // FIXME: implement throw new NotImplementedException(); }
public void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { // Method intentionally left empty. }
public void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) => instanceContext.Extensions.Find <InstanceContextExtension>().OnIdle += callback;
public void NotifyIdle (InstanceContextIdleCallback callback, InstanceContext instanceContext) { // FIXME: implement throw new NotImplementedException (); }
public void NotifyIdle(InstanceContextIdleCallback callback, InstanceContext instanceContext) { SharedInstanceContextInfo info = instanceContext.Extensions.Find <SharedInstanceContextInfo>(); info.SetIdleCallback(callback); }