/** * @throws AlreadyClosedException if this TermVectorsReader is closed */ private void ensureOpen() throws AlreadyClosedException { if (closed) { throw new AlreadyClosedException("this FieldsReader is closed"); } }
protected final void ensureOpen(Exception suppressed) { if (isClosed.get()) { AlreadyClosedException ace = new AlreadyClosedException(shardId + " engine is closed", failedEngine.get()); if (suppressed != null) { ace.addSuppressed(suppressed); } throw ace; } }
protected final void ensureOpen(Exception suppressed) { if (isClosed.get()) { AlreadyClosedException ace = new AlreadyClosedException(shardId + " engine is closed", failedEngine.get()); if (suppressed != null) { ace.addSuppressed(suppressed); } throw ace; } }
/** * @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); } }
private void ensureOpen() throws AlreadyClosedException { if (closed) { throw new AlreadyClosedException("this DocumentsWriter is closed"); } }
private void ensureOpen() { if (closed) { throw new AlreadyClosedException("this instance is closed"); } }
private void ensureOpen() { if (in == null) { throw new AlreadyClosedException("Already closed."); } } }
@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); } } }
/** * Throws AlreadyClosedException if this IndexReader or any * of its child readers is closed, otherwise returns. */ protected final void ensureOpen() throws AlreadyClosedException { if (refCount.get() <= 0) { throw new AlreadyClosedException("this IndexReader is closed"); } // the happens before rule on reading the refCount, which must be after the fake write, // ensures that we see the value: if (closedByChild) { throw new AlreadyClosedException("this IndexReader cannot be used anymore as one of its child readers was closed"); } }
@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); } }
/** {@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); }
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"); }
@Override public synchronized void close() throws IOException { if (closed) { return; } try { synchronized (locks) { if (!locks.remove(lockName)) { throw new AlreadyClosedException("Lock was already released: " + this); } } } finally { closed = true; } }
private static final void clearLockHeld(Path path) throws IOException { boolean remove = LOCK_HELD.remove(path.toString()); if (remove == false) { throw new AlreadyClosedException("Lock path was cleared but never marked as held: " + path); } }