Fix AzureRepositoryF to handle exceptions on close
Fix TribeUnitTests to handle exceptions on close
This commit is contained in:
parent
6814f24009
commit
e24fac644a
|
@ -19,12 +19,15 @@
|
|||
|
||||
package org.elasticsearch.repositories.azure;
|
||||
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.node.MockNode;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.plugin.repository.azure.AzureRepositoryPlugin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
|
@ -112,7 +115,11 @@ public class AzureRepositoryF {
|
|||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
node.close();
|
||||
try {
|
||||
IOUtils.close(node);
|
||||
} catch (IOException e) {
|
||||
throw new ElasticsearchException(e);
|
||||
}
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.elasticsearch.tribe;
|
||||
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
|
@ -34,6 +35,7 @@ import org.elasticsearch.test.InternalTestCluster;
|
|||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.either;
|
||||
|
@ -76,10 +78,9 @@ public class TribeUnitTests extends ESTestCase {
|
|||
}
|
||||
|
||||
@AfterClass
|
||||
public static void closeTribes() {
|
||||
tribe1.close();
|
||||
public static void closeTribes() throws IOException {
|
||||
IOUtils.close(tribe1, tribe2);
|
||||
tribe1 = null;
|
||||
tribe2.close();
|
||||
tribe2 = null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue