* 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");
}
}