<PackageReference Include="Relativity.Server.Import.SDK" Version="2.9.2" />

ProcessPool2

sealed class ProcessPool2
Represents a class object to manage 1 or more IRunnable objects. This class cannot be inherited.
using System; using System.Collections.Concurrent; using System.Threading; namespace Relativity.DataExchange.Process { internal sealed class ProcessPool2 { private readonly ConcurrentDictionary<Guid, Thread> threadDictionary; public ProcessPool2() { threadDictionary = new ConcurrentDictionary<Guid, Thread>(); } public void Abort(Guid processId) { if (threadDictionary.TryRemove(processId, out Thread value)) value.Abort(); } public void Remove(Guid processId) { if (threadDictionary.TryRemove(processId, out Thread value) && value.ThreadState != ThreadState.Stopped) value.Abort(); } public Guid Start(IRunnable runnable) { if (runnable == null) throw new ArgumentNullException("runnable"); Guid guid2 = runnable.ProcessId = Guid.NewGuid(); Thread thread = new Thread(runnable.Start); thread.SetApartmentState(ApartmentState.STA); thread.Start(); threadDictionary.TryAdd(guid2, thread); return guid2; } } }