public void Dispose() { if (CancellationTokenSourceDurationTest != null) { CancellationTokenSourceDurationTest.Cancel(); } if (TaskStartDurationTest != null) { TaskStartDurationTest.Dispose(); } if (CancellationTokenSourceAppDomainTask != null) { CancellationTokenSourceAppDomainTask.Cancel(); } if (AppDomainTask != null) { AppDomainTask.Dispose(); } if (FiddlerCapture != null) { FiddlerCapture.Dispose(); } Settings.Default.NumberOfManagers = NumberOfManagers; Settings.Default.NumberOfNodes = NumberOfNodes; Settings.Default.Save(); }
public virtual void TestFixtureTearDown() { if (AppDomainTask != null) { AppDomainTask.Dispose(); } }
public void ShutDownConsoleHost() { if (CancellationTokenSourceAppDomainTask != null) { CancellationTokenSourceAppDomainTask.Cancel(); } if (AppDomainTask != null) { AppDomainTask.Dispose(); } IsConsoleHostStarted = false; }
/// <summary> /// Gets or creates a storage module with the given name /// </summary> /// <returns>The storage module or null.</returns> /// <param name="name">The name of the module to get.</param> /// <param name="key">The session key of the module, or null.</param> /// <param name="ttl">The module time-to-live, zero or less means no expiration.</param> /// <param name="autocreate">Automatically create storage if not found</param> public async Task <IStorageEntry> GetStorageAsync(string name, string key, int ttl, bool autocreate) { var appdomaintask = new AppDomainTask(); m_getStorageCallback.Invoke(m_wrapped, new object[] { name, key, ttl, autocreate, appdomaintask }); var res = await appdomaintask.ResultAsync(); if (res == null) { return(null); } return(new StorageEntryWrapper(res)); }
public void StartConsoleHost() { Task.Factory.StartNew(() => { CancellationTokenSourceAppDomainTask = new CancellationTokenSource(); AppDomainTask = new AppDomainTask("Debug"); var task = AppDomainTask.StartTask(NumberOfManagers, NumberOfNodes, useLoadBalancerIfJustOneManager: true, cancellationTokenSource: CancellationTokenSourceAppDomainTask); IsConsoleHostStarted = true; }); }
public virtual void TestFixtureSetUp() { HttpSender = new HttpSender(); HttpRequestManager = new HttpRequestManager(); AppDomain = AppDomain.CurrentDomain; ManagerDbConnectionString = ConfigurationManager.ConnectionStrings["ManagerConnectionString"].ConnectionString; var configurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; XmlConfigurator.ConfigureAndWatch(new FileInfo(configurationFile)); DatabaseHelper.ClearDatabase(ManagerDbConnectionString); CancellationTokenSource = new CancellationTokenSource(); AppDomainTask = new AppDomainTask(BuildMode); Task = AppDomainTask.StartTask(numberOfManagers: NumberOfManagers, numberOfNodes: NumberOfNodes, useLoadBalancerIfJustOneManager: UseLoadBalancerIfJustOneManager, cancellationTokenSource: CancellationTokenSource); bool managerUp = HttpRequestManager.IsManagerUp(); while (!managerUp) { managerUp = HttpRequestManager.IsManagerUp(); } if (WaitToStartUp) { var sqlNotiferCancellationTokenSource = new CancellationTokenSource(); var sqlNotifier = new SqlNotifier(ManagerDbConnectionString); var task = sqlNotifier.CreateNotifyWhenNodesAreUpTask(NumberOfNodes, sqlNotiferCancellationTokenSource); task.Start(); sqlNotifier.NotifyWhenAllNodesAreUp.Wait(TimeSpan.FromMinutes(10)); sqlNotifier.Dispose(); } }
/// <summary> /// Gets or creates a storage module with the given name /// </summary> /// <returns>The storage module or null.</returns> /// <param name="name">The name of the module to get.</param> /// <param name="key">The session key of the module, or null.</param> /// <param name="ttl">The module time-to-live, zero or less means no expiration.</param> /// <param name="autocreate">Automatically create storage if not found</param> /// <param name="handler">The callback handler</param> public void GetStorageCallback(string name, string key, int ttl, bool autocreate, AppDomainTask handler) { AppDomainTask.HandleTask(GetStorageAsync(name, key, ttl, autocreate), handler); }