Use IOUtils#close() where needed
This commit is contained in:
parent
87737d3e02
commit
ac87751b3d
|
@ -20,6 +20,7 @@
|
||||||
package org.elasticsearch.bootstrap;
|
package org.elasticsearch.bootstrap;
|
||||||
|
|
||||||
import org.apache.lucene.util.Constants;
|
import org.apache.lucene.util.Constants;
|
||||||
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.apache.lucene.util.StringHelper;
|
import org.apache.lucene.util.StringHelper;
|
||||||
import org.elasticsearch.ElasticsearchException;
|
import org.elasticsearch.ElasticsearchException;
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
|
@ -159,14 +160,12 @@ final class Bootstrap {
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (node != null) {
|
|
||||||
try {
|
try {
|
||||||
node.close();
|
IOUtils.close(node);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new ElasticsearchException("failed to stop node", ex);
|
throw new ElasticsearchException("failed to stop node", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +232,7 @@ final class Bootstrap {
|
||||||
|
|
||||||
static void stop() throws IOException {
|
static void stop() throws IOException {
|
||||||
try {
|
try {
|
||||||
INSTANCE.node.close();
|
IOUtils.close(INSTANCE.node);
|
||||||
} finally {
|
} finally {
|
||||||
INSTANCE.keepAliveLatch.countDown();
|
INSTANCE.keepAliveLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue