/** * @throws AlreadyClosedException if this TermVectorsReader is closed */ private void ensureOpen() throws AlreadyClosedException { if (closed) { throw new AlreadyClosedException("this FieldsReader is closed"); } }
/** * @throws AlreadyClosedException if this FieldsReader is closed */ private void ensureOpen() throws AlreadyClosedException { if (closed) { throw new AlreadyClosedException("this FieldsReader is closed"); } }
private void ensureOpen() { if (closed) { throw new AlreadyClosedException("this SearcherLifetimeManager instance is closed"); } }
@Override protected final void ensureOpen() throws AlreadyClosedException { if (!isOpen) { throw new AlreadyClosedException("this Directory is closed"); } }
private void ensureOpen() { if (delegate == null) { throw new AlreadyClosedException("Already closed."); } } }
private void ensureOpen() { if (current == null) { throw new AlreadyClosedException(REFERENCE_MANAGER_IS_CLOSED_MSG); } }
@Override public void ensureValid() throws IOException { if (closed) { throw new AlreadyClosedException("Lock instance already released: " + this); } // check we are still in the locks map (some debugger or something crazy didn't remove us) synchronized (locks) { if (!locks.contains(lockName)) { throw new AlreadyClosedException("Lock instance was invalidated from map: " + this); } } }
/** {@inheritDoc} */ @Override public void ensureValid() throws IOException { if (closed) throw new AlreadyClosedException("Lock instance already released: " + this); // check we are still in the locks map (some debugger or something crazy didn't remove us) if (!locks.contains(lockName)) throw new AlreadyClosedException("Lock instance was invalidated from map: " + this); }
@Override public long getFilePointer() { try { return (((long) curBufIndex) << chunkSizePower) + curBuf.position(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
@Override public long getFilePointer() { try { return curBuf.position(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
private void setPos(long pos, int bi) throws IOException { try { final ByteBuffer b = buffers[bi]; b.position((int) (pos & chunkSizeMask)); this.curBufIndex = bi; this.curBuf = b; } catch (ArrayIndexOutOfBoundsException | IllegalArgumentException aioobe) { throw new EOFException("seek past EOF: " + this); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
void incRef() { int count; while ((count = ref.get()) > 0) { if (ref.compareAndSet(count, count+1)) { return; } } throw new AlreadyClosedException("SegmentCoreReaders is already closed"); }
/** {@inheritDoc} */ @Override public void close() throws IOException { if (closed) return; try { if (!locks.remove(lockName)) throw new AlreadyClosedException("Lock was already released: " + this); } finally { closed = true; } }
@Override public byte readByte(long pos) throws IOException { try { final int bi = (int) (pos >> chunkSizePower); return guard.getByte(buffers[bi], (int) (pos & chunkSizeMask)); } catch (IndexOutOfBoundsException ioobe) { throw new EOFException("seek past EOF: " + this); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
/** * Sets the stored value. * * @param storedValue Value to store * @throws AlreadyClosedException if the Analyzer is closed. */ protected final void setStoredValue(Analyzer analyzer, Object storedValue) { if (analyzer.storedValue == null) { throw new AlreadyClosedException("this Analyzer is closed"); } analyzer.storedValue.set(storedValue); }
/** * Returns the currently stored value. * * @return Currently stored value or {@code null} if no value is stored * @throws AlreadyClosedException if the Analyzer is closed. */ protected final Object getStoredValue(Analyzer analyzer) { if (analyzer.storedValue == null) { throw new AlreadyClosedException("this Analyzer is closed"); } return analyzer.storedValue.get(); }
void ensureOpen() throws AlreadyClosedException { writer.ensureOpen(false); // since we allow 'closing' state, we must still check this, we could be closing because we hit e.g. OOM if (writer.tragedy.get() != null) { throw new AlreadyClosedException("refusing to delete any files: this IndexWriter hit an unrecoverable exception", writer.tragedy.get()); } }
/** {@inheritDoc} */ @Override public IndexInput clone() { GridLuceneInputStream clone = (GridLuceneInputStream) super.clone(); if(closed) throw new AlreadyClosedException(toString()); clone.isClone = true; return clone; }
@Override public final int readInt() throws IOException { try { return guard.getInt(curBuf); } catch (BufferUnderflowException e) { return super.readInt(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }
@Override public final long readLong() throws IOException { try { return guard.getLong(curBuf); } catch (BufferUnderflowException e) { return super.readLong(); } catch (NullPointerException npe) { throw new AlreadyClosedException("Already closed: " + this); } }