Exemple #1
0
        public void Dispose()
        {
            _eventLoopCancellationTokenSource.Cancel();
            _eventLoopTask.Wait(500);

            PersistentState.Dispose();
        }
Exemple #2
0
        public void Dispose()
        {
            _eventLoopCancellationTokenSource.Cancel();

            var exceptions = new List <Exception>();

            try
            {
                _eventLoopTask.Wait(1000);
            }
            catch (Exception e)
            {
                exceptions.Add(e);
            }

            try
            {
                PersistentState.Dispose();
            }
            catch (Exception e)
            {
                exceptions.Add(e);
            }

            try
            {
                _raftEngineOptions.Dispose();
            }
            catch (Exception e)
            {
                exceptions.Add(e);
            }

            if (exceptions.Count == 0)
            {
                return;
            }

            throw new AggregateException(exceptions);
        }