public override Object Clone() { IndexInput clone = null; try { this.fileMutex.WaitOne(); clone = new CachedIndexInput(this); } finally { this.fileMutex.ReleaseMutex(); } Debug.Assert(clone != null); return(clone); }
// ctor for clone private CachedIndexInput(CachedIndexInput cloneInput) { this.name = cloneInput.name; this.fileMutex = BlobMutexManager.GrabMutex(this.name); this.fileMutex.WaitOne(); try { #if FULLDEBUG Debug.WriteLine("Creating clone for " + this.name); #endif this.indexInput = cloneInput.indexInput.Clone() as IndexInput; // FRAGILE: ASSUME: File is already downloaded and current } 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 Debug.WriteLine("Dagnabbit, falling back to memory clone for " + this.name); } finally { this.fileMutex.ReleaseMutex(); } }
public override Object Clone() { IndexInput clone = null; try { this.fileMutex.WaitOne(); clone = new CachedIndexInput( this ); } finally { this.fileMutex.ReleaseMutex(); } Debug.Assert( clone != null ); return clone; }
// ctor for clone private CachedIndexInput( CachedIndexInput cloneInput ) { this.name = cloneInput.name; this.fileMutex = BlobMutexManager.GrabMutex( this.name ); this.fileMutex.WaitOne(); try { #if FULLDEBUG Debug.WriteLine( "Creating clone for " + this.name ); #endif this.indexInput = cloneInput.indexInput.Clone() as IndexInput; // FRAGILE: ASSUME: File is already downloaded and current } 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 Debug.WriteLine( "Dagnabbit, falling back to memory clone for " + this.name ); } finally { this.fileMutex.ReleaseMutex(); } }