RazorDB.KeyValueStore.Close C# (CSharp) Method

Close() public method

public Close ( bool fast = false ) : void
fast bool
return void
        public void Close(bool fast = false) {
            // Make sure any inflight rotations have occurred before shutting down.
            if (!_rotationSemaphore.WaitOne(30000))
                throw new TimeoutException("Timed out waiting for table rotation to complete.");
            // Release again in case another thread tries to close it again.
            _rotationSemaphore.Release();

            if (!finalizing && !fast) {
                TableManager.Default.Close(this);
            }
            if (_currentJournaledMemTable != null) {
                _currentJournaledMemTable.Close();
                _currentJournaledMemTable = null;
            }

            if (_secondaryIndexes != null) {
                foreach (var idx in _secondaryIndexes) {
                    idx.Value.Close(fast);
                }
            }

            // Don't finalize since we already closed it.
            GC.SuppressFinalize(this);
        }

Usage Example

コード例 #1
0
ファイル: Program.cs プロジェクト: gnoso/razordb
        static void CheckDatabase(string baseDir)
        {
            Console.WriteLine("Checking Key Value Store '{0}'", baseDir);

            RazorCache cache = new RazorCache();
            var kv = new KeyValueStore(baseDir, cache);
            try {
                kv.ScanCheck();
            } finally {
                kv.Close();
            }
        }
All Usage Examples Of RazorDB.KeyValueStore::Close