Polish
This commit is contained in:
parent
132467787c
commit
27922ae325
|
|
@ -48,21 +48,16 @@ public class CassandraHealthIndicator extends AbstractHealthIndicator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doHealthCheck(Health.Builder builder) throws Exception {
|
protected void doHealthCheck(Health.Builder builder) throws Exception {
|
||||||
try {
|
Select select = QueryBuilder.select("release_version").from("system",
|
||||||
Select select = QueryBuilder.select("release_version").from("system",
|
"local");
|
||||||
"local");
|
ResultSet results = this.cassandraOperations.getCqlOperations()
|
||||||
ResultSet results = this.cassandraOperations.getCqlOperations()
|
.queryForResultSet(select);
|
||||||
.queryForResultSet(select);
|
if (results.isExhausted()) {
|
||||||
if (results.isExhausted()) {
|
builder.up();
|
||||||
builder.up();
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
String version = results.one().getString(0);
|
|
||||||
builder.up().withDetail("version", version);
|
|
||||||
}
|
|
||||||
catch (Exception ex) {
|
|
||||||
builder.down(ex);
|
|
||||||
}
|
}
|
||||||
|
String version = results.one().getString(0);
|
||||||
|
builder.up().withDetail("version", version);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,16 +108,11 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator
|
||||||
builder.up().withDetail("database", product);
|
builder.up().withDetail("database", product);
|
||||||
String validationQuery = getValidationQuery(product);
|
String validationQuery = getValidationQuery(product);
|
||||||
if (StringUtils.hasText(validationQuery)) {
|
if (StringUtils.hasText(validationQuery)) {
|
||||||
try {
|
// Avoid calling getObject as it breaks MySQL on Java 7
|
||||||
// Avoid calling getObject as it breaks MySQL on Java 7
|
List<Object> results = this.jdbcTemplate.query(validationQuery,
|
||||||
List<Object> results = this.jdbcTemplate.query(validationQuery,
|
new SingleColumnRowMapper());
|
||||||
new SingleColumnRowMapper());
|
Object result = DataAccessUtils.requiredSingleResult(results);
|
||||||
Object result = DataAccessUtils.requiredSingleResult(results);
|
builder.withDetail("hello", result);
|
||||||
builder.withDetail("hello", result);
|
|
||||||
}
|
|
||||||
catch (Exception ex) {
|
|
||||||
builder.down(ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,10 @@ public class Neo4jHealthIndicator extends AbstractHealthIndicator {
|
||||||
* {@link Health.Builder Builder}.
|
* {@link Health.Builder Builder}.
|
||||||
* @param session the session to use to execute a cypher statement
|
* @param session the session to use to execute a cypher statement
|
||||||
* @param builder the builder to add details to
|
* @param builder the builder to add details to
|
||||||
|
* @throws Exception if getting health details failed
|
||||||
*/
|
*/
|
||||||
protected void extractResult(Session session, Health.Builder builder) {
|
protected void extractResult(Session session, Health.Builder builder)
|
||||||
|
throws Exception {
|
||||||
Result result = session.query(CYPHER, Collections.emptyMap());
|
Result result = session.query(CYPHER, Collections.emptyMap());
|
||||||
builder.up().withDetail("nodes",
|
builder.up().withDetail("nodes",
|
||||||
result.queryResults().iterator().next().get("nodes"));
|
result.queryResults().iterator().next().get("nodes"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue