/// <summary> /// Starts a new AppDomain to accept workflow execution requests. /// </summary> public void Start(Scheduler scheduler, bool interactive) { if (interactive) { Console.WriteLine("Staring new host in AppDomain: {0}", ID); } lastTimeActive = DateTime.Now; // Create the new WorkflowHost inside the new AppDomain and unwrap the proxy workflowHost = (WorkflowApplicationHost)appDomain.CreateInstanceAndUnwrap( typeof(Jhu.Graywulf.Scheduler.WorkflowApplicationHost).Assembly.FullName, typeof(Jhu.Graywulf.Scheduler.WorkflowApplicationHost).FullName); workflowHost.ContextGuid = contextGuid; // Now create a reference to the event handler and cache it in // workflowEventHandler. This is necessary to keep the delegate alive because // workflowHost is a proxy class and events are marshaled accross AppDomain // boundaries. workflowEventHandler = new EventHandler <HostEventArgs>(workflowHost_WorkflowEvent); workflowHost.WorkflowEvent += workflowEventHandler; // Start the new workflow host inside the new AppDomain workflowHost.Start(scheduler, interactive); }
private void InitializeMembers() { this.contextGuid = Guid.Empty; this.lastTimeActive = DateTime.MinValue; this.appDomain = null; this.workflowHost = null; this.WorkflowEvent = null; this.workflowEventHandler = null; }
/// <summary> /// Drain-stops the workflows hosted inside the app domain /// and unloads the AppDomain itself. /// </summary> public void Stop(TimeSpan timeout, bool interactive) { if (interactive) { Console.WriteLine("Stopping AppDomain: {0}", ID); } workflowHost.Stop(timeout); workflowHost = null; // TODO: implement this using the AppDomainManager //AppDomain.Unload(appDomain); }
private void InitializeMembers() { this.contextGuid = Guid.Empty; this.lastTimeActive = DateTime.MinValue; this.appDomain = null; this.workflowHost = null; this.WorkflowEvent = null; this.workflowEventHandler = null; }
/// <summary> /// Drain-stops the workflows hosted inside the app domain /// and unloads the AppDomain itself. /// </summary> public void Stop(TimeSpan timeout, bool interactive) { if (interactive) { Console.WriteLine("Stopping AppDomain: {0}", ID); } workflowHost.Stop(timeout); workflowHost = null; // TODO: implement this using the AppDomainManager //AppDomain.Unload(appDomain); }
/// <summary> /// Starts a new AppDomain to accept workflow execution requests. /// </summary> public void Start(Scheduler scheduler, bool interactive) { if (interactive) { Console.WriteLine("Staring new host in AppDomain: {0}", ID); } lastTimeActive = DateTime.Now; // Create the new WorkflowHost inside the new AppDomain and unwrap the proxy workflowHost = (WorkflowApplicationHost)appDomain.CreateInstanceAndUnwrap( typeof(Jhu.Graywulf.Scheduler.WorkflowApplicationHost).Assembly.FullName, typeof(Jhu.Graywulf.Scheduler.WorkflowApplicationHost).FullName); workflowHost.ContextGuid = contextGuid; // Now create a reference to the event handler and cache it in // workflowEventHandler. This is necessary to keep the delegate alive because // workflowHost is a proxy class and events are marshaled accross AppDomain // boundaries. workflowEventHandler = new EventHandler<HostEventArgs>(workflowHost_WorkflowEvent); workflowHost.WorkflowEvent += workflowEventHandler; // Start the new workflow host inside the new AppDomain workflowHost.Start(scheduler, interactive); }