use of org.apache.solr.client.solrj.response.SolrPingResponse in project ddf by codice.
the class SolrClientAdapter method clientPing.
@SuppressWarnings("squid:S1181")
private SolrPingResponse clientPing(String collection) throws SolrServerException, IOException {
try {
lastPing.set(System.currentTimeMillis());
final SolrPingResponse response;
if (collection != null) {
response = pingClient.ping(collection);
} else {
response = pingClient.ping();
}
if (response == null) {
LOGGER.debug(SolrClientAdapter.FAILED_TO_PING, core, "null response");
setConnecting(realClient, new UnavailableSolrClient(new UnavailableSolrException("ping failed with no response")), true, State.CONNECTED);
return response;
}
final Object status = response.getResponse().get("status");
if (SolrClientAdapter.OK_STATUS.equals(status)) {
setConnected(true);
} else {
LOGGER.debug(SolrClientAdapter.FAILED_TO_PING_WITH_STATUS, core, status);
setConnecting(realClient, new UnavailableSolrClient(new UnavailableSolrException("ping failed with " + status + " status")), true, State.CONNECTED);
}
return response;
} catch (UnavailableSolrException | VirtualMachineError e) {
throw e;
} catch (Throwable t) {
LOGGER.debug(SolrClientAdapter.FAILED_TO_PING, core, t, t);
setConnecting(realClient, new UnavailableSolrClient(t), true, State.CONNECTED);
throw t;
}
}
Aggregations