Example usage for org.apache.solr.common.cloud SolrZooKeeper close

List of usage examples for org.apache.solr.common.cloud SolrZooKeeper close

Introduction

In this page you can find the example usage for org.apache.solr.common.cloud SolrZooKeeper close.

Prototype

@Override
    public synchronized void close() throws InterruptedException 

Source Link

Usage

From source file:com.shaie.solr.MiniSolrCloudCluster.java

License:Apache License

/**
 * Kills the Solr instance identified by the given {@code nodeId}. Unlike {@link #stopSolr(String)}, this method
 * prevents Solr from doing a graceful shutdown, so that states recorded in ZooKeeper aren't consistent.
 *///  w w  w  .j av  a  2  s . co  m
public void killSolr(String nodeId) {
    final JettySolrRunner solrRunner = getJettySolrRunner(nodeId);
    final SolrDispatchFilter solrFilter = solrRunner.getSolrDispatchFilter();
    final SolrZooKeeper solrZooKeeper = solrFilter.getCores().getZkController().getZkClient()
            .getSolrZooKeeper();
    try {
        // solrZooKeeper.closeCnxn() doesn't really work
        solrZooKeeper.close();
    } catch (final InterruptedException e) {
        throw new RuntimeException(e);
    }
    stopSolr(nodeId);
}