Example #1
0
        public override System.Object Clone()
        {
            IndexInput clone = null;

            try
            {
                _fileMutex.WaitOne();
                CompositeIndexInput input = new CompositeIndexInput(this, "clone");
                clone = (IndexInput)input;
            }
            catch (System.Exception err)
            {
                Debug.WriteLine(err.ToString());
            }
            finally
            {
                _fileMutex.ReleaseMutex();
            }
            Debug.Assert(clone != null);
            return(clone);
        }
Example #2
0
        public CompositeIndexInput(CompositeIndexInput cloneInput, string resourceDescription) : base(resourceDescription)
        {
            _fileMutex = SyncMutexManager.GrabMutex(cloneInput._name);
            _fileMutex.WaitOne();

            try
            {
#if FULLDEBUG
                Debug.WriteLine(String.Format("Creating clone for {0}", cloneInput._name));
#endif
                _syncDirectory = cloneInput._syncDirectory;
                _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
                Debug.WriteLine(String.Format("Dagnabbit, falling back to memory clone for {0}", cloneInput._name));
            }
            finally
            {
                _fileMutex.ReleaseMutex();
            }
        }