Check engine reference for null before flushing

If we close the shard before the engine is started we see a NPE in
the logs which is not problematic since the relevant parts are in a
finally block. Yet, the NPE is unnecessary and can be confusing.
This commit is contained in:
Simon Willnauer 2015-05-21 21:24:04 +02:00
parent 581bfc74c6
commit cbead88273
1 changed files with 1 additions and 1 deletions

View File

@ -761,7 +761,7 @@ public class IndexShard extends AbstractIndexShardComponent {
} finally {
final Engine engine = this.currentEngineReference.getAndSet(null);
try {
if (flushEngine && this.flushOnClose) {
if (engine != null && flushEngine && this.flushOnClose) {
engine.flushAndClose();
}
} finally { // playing safe here and close the engine even if the above succeeds - close can be called multiple times