private static void StartShreds(ShredStartupInfoList shredStartupInfoList) { if (null != shredStartupInfoList) { // create the data structure that will hold the shreds and their thread, etc. related objects foreach (ShredStartupInfo shredStartupInfo in shredStartupInfoList) { if (null != shredStartupInfo) { // clone the shredStartupInfo structure into the current AppDomain, otherwise, once the StagingDomain // has been unloaded, the shredStartupInfo structure will be destroyed ShredStartupInfo newShredStartupInfo = new ShredStartupInfo(shredStartupInfo.AssemblyPath, shredStartupInfo.ShredName, shredStartupInfo.ShredTypeName); // create the controller that will allow us to start and stop the shred ShredController shredController = new ShredController(newShredStartupInfo); _shredInfoList.Add(shredController); } } } foreach (ShredController shredController in _shredInfoList) { shredController.Start(); } }
public ShredController(ShredStartupInfo startupInfo) { Platform.CheckForNullReference(startupInfo, "startupInfo"); _startupInfo = startupInfo; _id = ShredController.NextId; _runningState = RunningState.Stopped; }