Exemplo n.º 1
0
        public void Dispose()
        {
            // dispose queue (wait finish)
            if (_queue.IsValueCreated)
            {
                _queue.Value.Dispose();
            }

            // get stream length from writer - is safe because only this instance
            // can change file size
            var delete = _logFactory.Exists() && _logPool.Writer.Length == 0;

            // dispose Stream pools
            _dataPool.Dispose();
            _logPool.Dispose();

            ENSURE(_dataFactory.IsLocked() == false, "datafile must be released");
            ENSURE(_dataFactory.IsLocked() == false, "logfile must be released");

            if (delete)
            {
                _logFactory.Delete();
            }

            // other disposes
            _cache.Dispose();
        }