Example usage for org.apache.solr.common.cloud OnReconnect OnReconnect

List of usage examples for org.apache.solr.common.cloud OnReconnect OnReconnect

Introduction

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

Prototype

OnReconnect

Source Link

Usage

From source file:com.doculibre.constellio.solr.context.SolrCoreContext.java

License:Open Source License

public static synchronized void init() {
    if (mainSolrServer == null) {
        try {/*from   ww w .ja  v  a 2  s . co m*/
            mainSolrServer = new CloudSolrServer(ConstellioSpringUtils.getZooKeeperAddress());
            mainSolrServer.setZkClientTimeout(ConstellioSpringUtils.getZooKeeperClientTimeout());
            mainSolrServer.setZkConnectTimeout(ConstellioSpringUtils.getZooKeeperConTimeout());
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }
    initCores();

    if (zkClient == null) {
        zkClient = new SolrZkClient(ConstellioSpringUtils.getZooKeeperAddress(),
                ConstellioSpringUtils.getZooKeeperClientTimeout(),
                ConstellioSpringUtils.getZooKeeperConTimeout(), new OnReconnect() {
                    @Override
                    public void command() {
                    }
                });
    }
}

From source file:com.ngdata.hbaseindexer.util.solr.SolrTestingUtility.java

License:Apache License

/**
 * Utility method to upload a Solr config into ZooKeeper. If you don't have the config in the form of
 * a filesystem directory, you might want to use {@link #uploadConfig(String, byte[], byte[])}.
 *//*from w  w w .  j  av a  2s . c o  m*/
public void uploadConfig(String confName, File confDir)
        throws InterruptedException, IOException, KeeperException {
    SolrZkClient zkClient = new SolrZkClient(zkConnectString, 30000, 30000, new OnReconnect() {
        @Override
        public void command() {
        }
    });
    ZkController.uploadConfigDir(zkClient, confDir, confName);
    zkClient.close();
}