예제 #1
0
        public AzureIndexInput(AzureIndexInput cloneInput)
        {
            _fileMutex = SyncMutexManager.GrabMutex(cloneInput._azureDirectory, cloneInput._name);
            _fileMutex.WaitOne();

            try
            {
#if FULLDEBUG
                Debug.WriteLine(String.Format("Creating clone for {0}", cloneInput._name));
#endif
                _azureDirectory = cloneInput._azureDirectory;
                _blobContainer  = cloneInput._blobContainer;
                _blob           = cloneInput._blob;
                _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();
            }
        }
예제 #2
0
        public AzureIndexInput(AzureIndexInput cloneInput)
        {
            _name           = cloneInput._name;
            _azureDirectory = cloneInput._azureDirectory;
            _blobContainer  = cloneInput._blobContainer;
            _blob           = cloneInput._blob;

            if (string.IsNullOrWhiteSpace(_name))
            {
                throw new ArgumentNullException(nameof(cloneInput._name));
            }
            if (_azureDirectory == null)
            {
                throw new ArgumentNullException(nameof(cloneInput._azureDirectory));
            }
            if (_blobContainer == null)
            {
                throw new ArgumentNullException(nameof(cloneInput._blobContainer));
            }
            if (_blob == null)
            {
                throw new ArgumentNullException(nameof(cloneInput._blob));
            }

            _fileMutex = SyncMutexManager.GrabMutex(cloneInput._azureDirectory, cloneInput._name);
            _fileMutex.WaitOne();

            try
            {
#if FULLDEBUG
                Trace.WriteLine($"Creating clone for {cloneInput._name}");
#endif
                _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.TraceError($"Dagnabbit, falling back to memory clone for {cloneInput._name}");
            }
            finally
            {
                _fileMutex.ReleaseMutex();
            }
        }
예제 #3
0
        public override System.Object Clone()
        {
            IndexInput clone = null;

            try
            {
                _fileMutex.WaitOne();
                AzureIndexInput input = new AzureIndexInput(this);
                clone = (IndexInput)input;
            }
            catch (System.Exception err)
            {
                Debug.WriteLine(err.ToString());
            }
            finally
            {
                _fileMutex.ReleaseMutex();
            }
            Debug.Assert(clone != null);
            return(clone);
        }
예제 #4
0
        public override object Clone()
        {
            IndexInput clone = null;

            try
            {
                _fileMutex.WaitOne();
                var input = new AzureIndexInput(this);
                clone = input;
            }
            catch (Exception err)
            {
                Trace.TraceError(err.ToString());
            }
            finally
            {
                _fileMutex.ReleaseMutex();
            }
            Debug.Assert(clone != null);
            return(clone);
        }