Java Code Examples for org.elasticsearch.node.Node#close()

The following examples show how to use org.elasticsearch.node.Node#close() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TribeService.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
protected void doStart() {
    for (Node node : nodes) {
        try {
            node.start();
        } catch (Throwable e) {
            // calling close is safe for non started nodes, we can just iterate over all
            for (Node otherNode : nodes) {
                try {
                    otherNode.close();
                } catch (Throwable t) {
                    logger.warn("failed to close node {} on failed start", t, otherNode);
                }
            }
            if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
            }
            throw new ElasticsearchException(e.getMessage(), e);
        }
    }
}
 
Example 2
Source File: TribeService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
protected void doClose() {
    for (Node node : nodes) {
        try {
            node.close();
        } catch (Throwable t) {
            logger.warn("failed to close node {}", t, node);
        }
    }
}
 
Example 3
Source File: NodeTestUtils.java    From elasticsearch-xml with Apache License 2.0 5 votes vote down vote up
private void closeNodes() throws IOException {
    logger.info("closing all clients");
    for (AbstractClient client : clients.values()) {
        client.close();
    }
    clients.clear();
    logger.info("closing all nodes");
    for (Node node : nodes.values()) {
        if (node != null) {
            node.close();
        }
    }
    nodes.clear();
    logger.info("all nodes closed");
}
 
Example 4
Source File: SearchClientServiceMockImpl.java    From elasticsearch-tutorial with MIT License 5 votes vote down vote up
public void closeNode(String id) {
    Client client = clients.remove(id);
    if (client != null) {
        client.close();
    }
    Node node = nodes.remove(id);
    if (node != null) {
        node.close();
    }
}
 
Example 5
Source File: SearchClientServiceMockImpl.java    From elasticsearch-tutorial with MIT License 5 votes vote down vote up
public void closeAllNodes() {
    for (Client client : clients.values()) {
        client.close();
    }
    clients.clear();
    for (Node node : nodes.values()) {
        node.close();
    }
    nodes.clear();
}
 
Example 6
Source File: AbstractNodeTestHelper.java    From elasticsearch-csv with Apache License 2.0 5 votes vote down vote up
public void closeAllNodes() throws IOException {
    for (AbstractClient client : clients.values()) {
        client.close();
    }
    clients.clear();
    for (Node node : nodes.values()) {
        if (node != null) {
            node.close();
        }
    }
    nodes.clear();
}
 
Example 7
Source File: SearchClientServiceMockImpl.java    From searchanalytics-bigdata with MIT License 5 votes vote down vote up
private void closeAllNodes() {
	for (final Client client : clients.values()) {
		client.close();
	}
	clients.clear();
	for (final Node node : nodes.values()) {
		node.close();
	}
	nodes.clear();
}
 
Example 8
Source File: AbstractNodeTest.java    From elasticsearch-gatherer with Apache License 2.0 5 votes vote down vote up
public void stopNode(String id) {
    Client client = clients.remove(id);
    if (client != null) {
        client.close();
    }
    Node node = nodes.remove(id);
    if (node != null) {
        node.close();
    }
}
 
Example 9
Source File: AbstractNodeTest.java    From elasticsearch-gatherer with Apache License 2.0 5 votes vote down vote up
public void closeAllNodes() {
    for (Client client : clients.values()) {
        client.close();
    }
    clients.clear();
    for (Node node : nodes.values()) {
        node.close();
    }
    nodes.clear();
}
 
Example 10
Source File: NodeTestUtils.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
private void closeNodes() throws IOException {
    logger.info("closing all clients");
    for (AbstractClient client : clients.values()) {
        client.close();
    }
    clients.clear();
    logger.info("closing all nodes");
    for (Node node : nodes.values()) {
        if (node != null) {
            node.close();
        }
    }
    nodes.clear();
    logger.info("all nodes closed");
}
 
Example 11
Source File: NodeTestUtils.java    From elasticsearch-analysis-baseform with Apache License 2.0 5 votes vote down vote up
private void closeNodes() throws IOException {
    logger.info("closing all clients");
    for (AbstractClient client : clients.values()) {
        client.close();
    }
    clients.clear();
    logger.info("closing all nodes");
    for (Node node : nodes.values()) {
        if (node != null) {
            node.close();
        }
    }
    nodes.clear();
    logger.info("all nodes closed");
}