Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
27922ae3
Commit
27922ae3
authored
Dec 14, 2017
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
13246778
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
25 deletions
+17
-25
CassandraHealthIndicator.java
...work/boot/actuate/cassandra/CassandraHealthIndicator.java
+9
-14
DataSourceHealthIndicator.java
...ramework/boot/actuate/jdbc/DataSourceHealthIndicator.java
+5
-10
Neo4jHealthIndicator.java
...ingframework/boot/actuate/neo4j/Neo4jHealthIndicator.java
+3
-1
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cassandra/CassandraHealthIndicator.java
View file @
27922ae3
...
@@ -48,21 +48,16 @@ public class CassandraHealthIndicator extends AbstractHealthIndicator {
...
@@ -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
);
}
}
}
}
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jdbc/DataSourceHealthIndicator.java
View file @
27922ae3
...
@@ -108,16 +108,11 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator
...
@@ -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
);
}
}
}
}
}
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/neo4j/Neo4jHealthIndicator.java
View file @
27922ae3
...
@@ -63,8 +63,10 @@ public class Neo4jHealthIndicator extends AbstractHealthIndicator {
...
@@ -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"
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment