mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Update SolrHealthIndicator to extend AbstractHealthIndicator
This commit is contained in:
parent
794808b6b8
commit
d8e783f856
@ -24,7 +24,7 @@ import org.apache.solr.client.solrj.SolrServer;
|
||||
* @author Andy Wilkinson
|
||||
* @since 1.1.0
|
||||
*/
|
||||
public class SolrHealthIndicator implements HealthIndicator {
|
||||
public class SolrHealthIndicator extends AbstractHealthIndicator {
|
||||
|
||||
private final SolrServer solrServer;
|
||||
|
||||
@ -33,15 +33,9 @@ public class SolrHealthIndicator implements HealthIndicator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Health health() {
|
||||
Health health = new Health();
|
||||
try {
|
||||
this.solrServer.ping();
|
||||
return health.up().withDetail("solrStatus",
|
||||
this.solrServer.ping().getResponse().get("status"));
|
||||
}
|
||||
catch (Exception e) {
|
||||
return health.down().withException(e);
|
||||
}
|
||||
protected void doHealthCheck(Health health) throws Exception {
|
||||
this.solrServer.ping();
|
||||
health.up().withDetail("solrStatus",
|
||||
this.solrServer.ping().getResponse().get("status"));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user