Ejemplo n.º 1
0
        /// <summary>
        /// Shutdown process:
        /// - Stop any new transaction
        /// - Stop operation loops over database (throw in SafePoint)
        /// - Wait for writer queue
        /// - Close disks
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            // this method can be called from Ctor, so many
            // of this members can be null yet (even if are readonly).
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                // stop running all transactions
                _transactions.ForEach((x, i) => i.Value.Abort());

                // try checkpoint
                _walIndex.Checkpoint(true);

                // close all disk connections
                _disk?.Dispose();

                // delete sort temp file
                this.SortDisk?.Dispose();

                // dispose lockers
                _locker?.Dispose();
            }

            _disposed = true;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Shutdown process:
        /// - Stop any new transaction
        /// - Stop operation loops over database (throw in SafePoint)
        /// - Wait for writer queue
        /// - Close disks
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            // this method can be called from Ctor, so many
            // of this members can be null yet (even if are readonly).
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                // stop running all transactions
                _monitor?.Dispose();

                // do a soft checkpoint (only if exclusive lock is possible)
                if (_settings.Checkpoint > 0)
                {
                    _walIndex?.Checkpoint(true);
                }

                // close all disk streams (and delete log if empty)
                _disk?.Dispose();

                // delete sort temp file
                _sortDisk?.Dispose();

                // dispose lockers
                _locker?.Dispose();
            }

            _disposed = true;
        }