private void EnsureOpen() { if (_closed) { throw AlreadyClosedException.Create(this.GetType().FullName, "this SearcherLifetimeManager instance is disposed."); } }
private void EnsureOpen() { if (closed) { throw AlreadyClosedException.Create(this.GetType().FullName, "this IndexWriter is disposed."); } }
// LUCENENET specific - rather than using all of this exception catching nonsense // for control flow, we check whether we are disposed first. private void EnsureOpen() { if (buffers is null) { throw AlreadyClosedException.Create(this.GetType().FullName, "Already disposed: " + this); } }
/// <summary> /// Throws <see cref="ObjectDisposedException"/> if this <see cref="Index.IndexReader"/> is disposed /// </summary> protected void EnsureOpen() { if (RefCount <= 0) { throw AlreadyClosedException.Create(this.GetType().FullName, "this TaxonomyReader is disposed."); } }
private void EnsureOpen() { if (closed) { throw AlreadyClosedException.Create(this.GetType().FullName, "CFS Directory is already disposed."); } }
public override object Clone() { if (_input is null) { throw AlreadyClosedException.Create(this.GetType().FullName, "this TermVectorsReader is disposed."); } return(new SimpleTextTermVectorsReader(_offsets, (IndexInput)_input.Clone())); }
/// <summary> /// Sets the stored value. /// </summary> /// <param name="analyzer"> Analyzer </param> /// <param name="storedValue"> Value to store </param> /// <exception cref="ObjectDisposedException"> if the <see cref="Analyzer"/> is closed. </exception> protected internal static void SetStoredValue(Analyzer analyzer, object storedValue) // LUCENENET: CA1822: Mark members as static { if (analyzer.storedValue is null) { throw AlreadyClosedException.Create(analyzer.GetType().FullName, "this Analyzer is disposed."); } analyzer.storedValue.Value = storedValue; }
public override object Clone() { if (_input == null) { throw AlreadyClosedException.Create(this.GetType().FullName, "this FieldsReader is disposed."); } return(new SimpleTextStoredFieldsReader(_offsets, (IndexInput)_input.Clone(), _fieldInfos)); }
/// <summary>Throws <see cref="ObjectDisposedException"/> if the client has already been disposed.</summary> protected void EnsureOpen() { if (!disposed) { return; } throw AlreadyClosedException.Create(this.GetType().FullName, "this update client has already been disposed."); }
public override void Flush() { // LUCENENET specific: Guard to ensure we aren't disposed. if (!isOpen) { throw AlreadyClosedException.Create(this.GetType().FullName, "This FSIndexOutput is disposed."); } file.Flush(); }
public override void Seek(long pos) { // LUCENENET specific: Guard to ensure we aren't disposed. if (!isOpen) { throw AlreadyClosedException.Create(this.GetType().FullName, "This FSIndexOutput is disposed."); } file.Seek(pos, SeekOrigin.Begin); }
/// <inheritdoc/> protected internal override void FlushBuffer(byte[] b, int offset, int size) { // LUCENENET specific: Guard to ensure we aren't disposed. if (!isOpen) { throw AlreadyClosedException.Create(this.GetType().FullName, "This FSIndexOutput is disposed."); } crc.Update(b, offset, size); file.Write(b, offset, size); }
/// <inheritdoc/> public override void WriteBytes(byte[] b, int offset, int length) { // LUCENENET specific: Guard to ensure we aren't disposed. if (!isOpen) { throw AlreadyClosedException.Create(this.GetType().FullName, "This FSIndexOutput is disposed."); } crc.Update(b, offset, length); file.Write(b, offset, length); }
private void EnsureOpen() { if (writer == null) { throw AlreadyClosedException.Create(this.GetType().FullName, "this IndexWriter is disposed."); } else { writer.EnsureOpen(false); } }
/// <summary> /// Ensure that replicator is still open, or throw <see cref="ObjectDisposedException"/> otherwise. /// </summary> /// <exception cref="ObjectDisposedException">This replicator has already been disposed.</exception> protected void EnsureOpen() { lock (padlock) { if (!disposed) { return; } throw AlreadyClosedException.Create(this.GetType().FullName, "This replicator has already been disposed."); } }
protected internal void EnsureOpen() { if (refCount <= 0) { throw AlreadyClosedException.Create(this.GetType().FullName, "this IndexReader is disposed."); } // the happens before rule on reading the refCount, which must be after the fake write, // ensures that we see the value: if (closedByChild) { throw AlreadyClosedException.Create(this.GetType().FullName, "this IndexReader cannot be used anymore as one of its child readers was disposed."); } }
internal void IncRef() { int count; while ((count = @ref) > 0) { if (@ref.CompareAndSet(count, count + 1)) { return; } } throw AlreadyClosedException.Create(this.GetType().FullName, "SegmentCoreReaders is already disposed."); }
/// <summary> /// Ensure that replicator is still open, or throw <see cref="ObjectDisposedException"/> otherwise. /// </summary> /// <exception cref="ObjectDisposedException">This replicator has already been disposed.</exception> protected void EnsureOpen() { UninterruptableMonitor.Enter(syncLock); try { if (!disposed) { return; } throw AlreadyClosedException.Create(this.GetType().FullName, "This replicator has already been disposed."); } finally { UninterruptableMonitor.Exit(syncLock); } }
/// <summary> /// Expert: decreases the <see cref="RefCount"/> of this <see cref="IndexReader"/> /// instance. If the <see cref="RefCount"/> drops to 0, then this /// reader is disposed. If an exception is hit, the <see cref="RefCount"/> /// is unchanged. /// </summary> /// <exception cref="IOException"> in case an <see cref="IOException"/> occurs in <see cref="DoClose()"/> /// </exception> /// <seealso cref="IncRef"/> public void DecRef() { // only check refcount here (don't call ensureOpen()), so we can // still close the reader if it was made invalid by a child: if (refCount <= 0) { throw AlreadyClosedException.Create(this.GetType().FullName, "this IndexReader is disposed."); } int rc = refCount.DecrementAndGet(); if (rc == 0) { closed = true; Exception throwable = null; try { DoClose(); } catch (Exception th) when(th.IsThrowable()) { throwable = th; } finally { try { ReportCloseToParentReaders(); } finally { NotifyReaderClosedListeners(throwable); } } } else if (rc < 0) { throw IllegalStateException.Create("too many decRef calls: refCount is " + rc + " after decrement"); } }