public void close() throws IOException { if(cache == null) { cloudSolrClient.close(); } }
public void close() throws IOException { if(cache == null) { cloudSolrClient.close(); } }
public void close() throws IOException { if(cache == null) { if (cloudSolrClient != null) { cloudSolrClient.close(); } } }
@Override public void close() throws IOException { if(cache == null && cloudSolrClient != null) { cloudSolrClient.close(); } tupleSource.close(); }
/** * Closes the CloudSolrStream **/ public void close() throws IOException { for(TupleStream solrStream : solrStreams) { solrStream.close(); } if(cache == null) { cloudSolrClient.close(); } }
@Override public void distribTearDown() throws Exception { if (VERBOSE || printLayoutOnTearDown) { super.printLayout(); } closeRestTestHarnesses(); // TODO: close here or later? if (commonCloudSolrClient != null) { commonCloudSolrClient.close(); } if (controlClient != null) { controlClient.close(); } if (cloudClient != null) { cloudClient.close(); } if (controlClientCloud != null) { controlClientCloud.close(); } super.distribTearDown(); System.clearProperty("zkHost"); System.clearProperty("numShards"); // close socket proxies after super.distribTearDown if (!proxies.isEmpty()) { for (SocketProxy proxy : proxies.values()) { proxy.close(); } } }
if (client != null) { try { client.close(); } catch (IOException e) { throw new RuntimeException(
public void close() throws IOException { try { if (initialRun || runCount > 0) { persistCheckpoints(); initialRun = false; runCount = 0; } } finally { if(solrStreams != null) { for (TupleStream solrStream : solrStreams) { solrStream.close(); } } if (streamContext != null && streamContext.getSolrClientCache() == null) { cloudSolrClient.close(); } } }
server.setDefaultCollection(options.collection); server.commit(); server.close(); } else { for (List<String> urls : options.shardUrls) {
return cloudSolrServer; } else { cloudSolrServer.close(); throw new IOException("the found SolrCloud server is not alive"); cloudSolrServer.close(); throw new IOException("the found SolrCloud server is not alive"); } else { cloudSolrServer.close(); throw new IOException("could not connect to Zookeeper hosted at " + remoteSolrServerConfiguration.getSolrZkHost());
return cloudSolrServer; } else { cloudSolrServer.close(); throw new IOException("the found SolrCloud server is not alive"); cloudSolrServer.close(); throw new IOException("the found SolrCloud server is not alive"); } else { cloudSolrServer.close(); throw new IOException("could not connect to Zookeeper hosted at " + remoteSolrServerConfiguration.getSolrZkHost());
final CloudSolrClient server = new CloudSolrClient("localhost:2181"); try { //probably this is the line that missed from your code... server.connect(); final ClusterState clusterState = server.getZkStateReader().getClusterState(); final DocCollection collection = clusterState.getCollection("collection1"); //EVRIKA! collection object // and get the leader of the collection...pretty easy. Replica leader = clusterState.getLeader("collection1", "shard1"); } catch (Exception e) { // do your stuff } finally { server.close(); }