@Override public void cleanup() { if (solrClient != null) { try { solrClient.close(); } catch (IOException e) { LOG.error("Error while closing solrClient", e); } } }
@Override public void close() throws BackendException { logger.trace("Shutting down connection to Solr", solrClient); try { solrClient.close(); } catch (IOException e) { throw new TemporaryBackendException(e); } }
@Override public void cleanup() throws DBException { try { client.close(); } catch (IOException e) { throw new DBException(e); } }
@Override public void cleanup() throws DBException { try { client.close(); } catch (IOException e) { throw new DBException(e); } }
public void destroy() throws Exception { //Make sure we shut down each of the SolrClient references (these is really the Solr clients despite the name) try { if (getServer() != null) { getServer().close();; } } catch (Exception e) { LOG.error("Error shutting down primary SolrClient (client).", e); } try { if (getReindexServer() != null && getReindexServer() != getServer()) { getReindexServer().close(); } } catch (Exception e) { LOG.error("Error shutting down reindex SolrClient (client).", e); } try { if (getAdminServer() != null && getAdminServer() != getServer() && getAdminServer() != getReindexServer()) { getAdminServer().close(); } } catch (Exception e) { LOG.error("Error shutting down admin SolrClient (client).", e); } } }
@Override public void buildSchema() throws IOException { SolrClient solrClient = null; try { solrClient = new CloudSolrClient(solrConfig.getZkHostString()); SchemaRequest schemaRequest = new SchemaRequest(); logger.debug("Downloading schema for collection: {}", collection); SchemaResponse schemaResponse = schemaRequest.process(solrClient, collection); logger.debug("SchemaResponse Schema: {}", schemaResponse); SchemaRepresentation schemaRepresentation = schemaResponse.getSchemaRepresentation(); schema.setName(schemaRepresentation.getName()); schema.setVersion(Float.toString(schemaRepresentation.getVersion())); schema.setUniqueKey(schemaRepresentation.getUniqueKey()); schema.setFieldTypes(getFieldTypes(schemaRepresentation)); schema.setFields(getFields(schemaRepresentation.getFields())); schema.setDynamicFields(getFields(schemaRepresentation.getDynamicFields())); schema.setCopyFields(getCopyFields(schemaRepresentation)); } catch (SolrServerException e) { logger.error("Error while getting schema for collection: {}", collection, e); throw new IOException("Error while getting schema for collection :" + collection, e); } finally { if (solrClient != null) { solrClient.close(); } } }
@OnStopped public final void closeClient() { if (solrClient != null) { try { solrClient.close(); } catch (IOException e) { getLogger().debug("Error closing SolrClient", e); } } if (kerberosUser != null) { try { kerberosUser.logout(); kerberosUser = null; } catch (LoginException e) { getLogger().debug("Error logging out keytab user", e); } } }
@Override public void close() throws IOException { solrClient.close(); } }
@Override public void shutDown() throws IOException { if (client != null) { client.close(); client = null; } }
@Override public void shutdown() { LOGGER.trace("shutdown"); try { server.close(); } catch (IOException e) { throw new RuntimeException(e); } }
public synchronized void close() { for(Map.Entry<String, SolrClient> entry : solrClients.entrySet()) { try { entry.getValue().close(); } catch (IOException e) { log.error("Error closing SolrClient for " + entry.getKey(), e); } } solrClients.clear(); } }
public void close() { Iterator<SolrClient> it = solrClients.values().iterator(); while(it.hasNext()) { try { it.next().close(); } catch (IOException e) { log.error(e.getMessage(), e); } } } }
public void close() throws IOException, SolrServerException { if (client != null) { client.commit(); client.close(); } } }
@Override public void cleanup() throws DBException { try { client.close(); } catch (IOException e) { throw new DBException(e); } }
@After public void afterClass() throws Exception { if (client != null) client.close(); client = null; }
@Override public void close() { if (solrClient != null) try { solrClient.close(); } catch (IOException e) { log.error("Cannot close search server", e); throw new SearchServerException("Cannot close search server", e); } }
private void commitSolr(Map<String, String> indexConnectionParams) throws SolrServerException, IOException { Set<SolrClient> servers = createSolrClients(indexConnectionParams); for (SolrClient server : servers) { server.commit(false, false); try { server.close(); } catch (java.io.IOException e) { throw new RuntimeException(e); } } }
private void clearSolr(Map<String, String> indexConnectionParams) throws SolrServerException, IOException { Set<SolrClient> servers = createSolrClients(indexConnectionParams); for (SolrClient server : servers) { server.deleteByQuery("*:*"); server.commit(false, false); try { server.close(); } catch (java.io.IOException e) { throw new RuntimeException(e); } } }
@After public void tearDown() throws Exception { collector = null; solrClient.close(); solrClient = null; super.tearDown(); }