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

            try
            {
                _fileMutex.WaitOne();
                SyncIndexInput input = new SyncIndexInput(this);
                clone = (IndexInput)input;
            }
            catch (System.Exception err)
            {
                Trace.WriteLine(err.ToString());
            }
            finally
            {
                _fileMutex.ReleaseMutex();
            }
            Debug.Assert(clone != null);
            return(clone);
        }
Example #2
0
        public SyncIndexInput(SyncIndexInput cloneInput)
        {
            _fileMutex = SyncMutexManager.GrabMutex(cloneInput._syncDirectory, 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
                Trace.Fail(String.Format("Dagnabbit, falling back to memory clone for {0}", cloneInput._name));
            }
            finally
            {
                _fileMutex.ReleaseMutex();
            }
        }
Example #3
0
 public override System.Object Clone()
 {
     IndexInput clone = null;
     try
     {
         _fileMutex.WaitOne();
         SyncIndexInput input = new SyncIndexInput(this);
         clone = (IndexInput)input;
     }
     catch (System.Exception err)
     {
         Trace.WriteLine(err.ToString());
     }
     finally
     {
         _fileMutex.ReleaseMutex();
     }
     Debug.Assert(clone != null);
     return clone;
 }
Example #4
0
        public SyncIndexInput(SyncIndexInput cloneInput)
        {
            _fileMutex = SyncMutexManager.GrabMutex(cloneInput._syncDirectory, 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
                Trace.Fail(String.Format("Dagnabbit, falling back to memory clone for {0}", cloneInput._name));
            }
            finally
            {
                _fileMutex.ReleaseMutex();
            }
        }