Catch IOExcption after core change

Original commit: elastic/x-pack-elasticsearch@1fa5a3dc82
This commit is contained in:
Simon Willnauer 2016-02-01 10:27:33 +01:00
parent 4a686f04cf
commit 6287a1300a
3 changed files with 30 additions and 6 deletions

View File

@ -5,6 +5,8 @@
*/
package org.elasticsearch.marvel;
import org.apache.lucene.util.IOUtils;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.CollectionUtils;
@ -12,6 +14,7 @@ import org.elasticsearch.node.MockNode;
import org.elasticsearch.node.Node;
import org.elasticsearch.xpack.XPackPlugin;
import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
@ -42,8 +45,13 @@ public class MarvelF {
@Override
public void run() {
node.close();
latch.countDown();
try {
IOUtils.close(node);
} catch (IOException e) {
throw new ElasticsearchException(e);
} finally {
latch.countDown();
}
}
});
node.start();

View File

@ -5,6 +5,8 @@
*/
package org.elasticsearch.shield;
import org.apache.lucene.util.IOUtils;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.common.io.PathUtils;
import org.elasticsearch.common.settings.Settings;
@ -17,6 +19,7 @@ import org.elasticsearch.shield.test.ShieldTestUtils;
import org.elasticsearch.test.ShieldSettingsSource;
import org.elasticsearch.xpack.XPackPlugin;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
@ -64,8 +67,13 @@ public class ShieldF {
@Override
public void run() {
node.close();
latch.countDown();
try {
IOUtils.close(node);
} catch (IOException ex) {
throw new ElasticsearchException(ex);
} finally {
latch.countDown();
}
}
});
node.start();

View File

@ -5,6 +5,8 @@
*/
package org.elasticsearch.watcher;
import org.apache.lucene.util.IOUtils;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.settings.Settings;
@ -12,6 +14,7 @@ import org.elasticsearch.node.MockNode;
import org.elasticsearch.node.Node;
import org.elasticsearch.xpack.XPackPlugin;
import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
@ -58,8 +61,13 @@ public class WatcherF {
@Override
public void run() {
node.close();
latch.countDown();
try {
IOUtils.close(node);
} catch (IOException e) {
throw new ElasticsearchException(e);
} finally {
latch.countDown();
}
}
});
node.start();