public SecureStoreIndexInput(SecureStoreDirectory directory, Directory cache, ISecureStore store, IEncryptor encryptor, StoreLocation location, string cachePath) { _directory = directory; _cache = cache; _name = cachePath; _fileMutex = BlobMutexManager.GrabMutex(_name); _fileMutex.WaitOne(); try { InitialiseFile(store, encryptor, location).WaitAndWrap(); } finally { _fileMutex.ReleaseMutex(); } }
protected override void Dispose(bool disposing) { _fileMutex.WaitOne(); try { _indexInput.Dispose(); _indexInput = null; _directory = null; _cache = null; GC.SuppressFinalize(this); } finally { _fileMutex.ReleaseMutex(); } }
private SecureStoreIndexInput(SecureStoreIndexInput cloneInput) { _fileMutex = BlobMutexManager.GrabMutex(cloneInput._name); _fileMutex.WaitOne(); try { _directory = cloneInput._directory; _cache = cloneInput._cache; _name = cloneInput._name; _indexInput = cloneInput._indexInput.Clone() as IndexInput; } catch (Exception) { // sometimes we get access denied on the 2nd stream...but not always. I haven't tracked it down yet // but this covers our tail until I do LeoTrace.WriteLine(String.Format("Falling back to memory clone for {0}", cloneInput._name)); } finally { _fileMutex.ReleaseMutex(); } }