protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                cancellationTokenSource.Cancel();
                _logger.Information("Disposing..........");
                // Indicate that no new tasks will be coming in
                _tasks.CompleteAdding();
                // _schedulerThread.Abort()
                // The Thread.Abort method is not supported in .NET Core. If you need to terminate the execution of third - party code
                // forcibly in .NET Core, run it in the separate process and use Process.Kill.
                _customThreadPool.Dispose();
                _schedulerThread.Join();
                _tasks.Dispose();
                cancellationTokenSource.Dispose();
            }

            _disposed = true;
        }