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