Update SolrHealthIndicator to extend AbstractHealthIndicator
This commit is contained in:
@@ -24,7 +24,7 @@ import org.apache.solr.client.solrj.SolrServer;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
public class SolrHealthIndicator implements HealthIndicator {
|
public class SolrHealthIndicator extends AbstractHealthIndicator {
|
||||||
|
|
||||||
private final SolrServer solrServer;
|
private final SolrServer solrServer;
|
||||||
|
|
||||||
@@ -33,15 +33,9 @@ public class SolrHealthIndicator implements HealthIndicator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Health health() {
|
protected void doHealthCheck(Health health) throws Exception {
|
||||||
Health health = new Health();
|
this.solrServer.ping();
|
||||||
try {
|
health.up().withDetail("solrStatus",
|
||||||
this.solrServer.ping();
|
this.solrServer.ping().getResponse().get("status"));
|
||||||
return health.up().withDetail("solrStatus",
|
|
||||||
this.solrServer.ping().getResponse().get("status"));
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
return health.down().withException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user