@Override protected boolean maybeFailEngine(String source, Throwable t) { boolean shouldFail = super.maybeFailEngine(source, t); if (shouldFail) { return true; } // Check for AlreadyClosedException if (t instanceof AlreadyClosedException) { // if we are already closed due to some tragic exception // we need to fail the engine. it might have already been failed before // but we are double-checking it's failed and closed if (indexWriter.isOpen() == false && indexWriter.getTragicException() != null) { failEngine( "already closed by tragic event on the index writer", indexWriter.getTragicException()); } else if (translog.isOpen() == false && translog.getTragicException() != null) { failEngine("already closed by tragic event on the translog", translog.getTragicException()); } return true; } else if (t != null && ((indexWriter.isOpen() == false && indexWriter.getTragicException() == t) || (translog.isOpen() == false && translog.getTragicException() == t))) { // this spot on - we are handling the tragic event exception here so we have to fail the // engine // right away failEngine(source, t); return true; } return false; }