-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't include non-configured data sources in health checks #21003
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I added a few suggestions!
Set<String> names = support.getConfiguredNames(); | ||
Set<String> excludedNames = support.getExcludedNames(); | ||
for (String name : names) { | ||
DataSource ds = name.equals(DataSourceUtil.DEFAULT_DATASOURCE_NAME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use DataSourceUtil.isDefault()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
boolean isDefault = DEFAULT_DS.equals(dataSource.getKey()); | ||
try (Connection con = dataSource.getValue().getConnection()) { | ||
boolean valid = con.isValid(0); | ||
boolean isDefault = DataSourceUtil.DEFAULT_DATASOURCE_NAME.equals(dataSource.getKey()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use DataSourceUtil.isDefault()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
for (String name : names) { | ||
DataSource ds = name.equals(DataSourceUtil.DEFAULT_DATASOURCE_NAME) | ||
? (DataSource) Arc.container().instance(DataSource.class).get() | ||
: (DataSource) Arc.container().instance(name).get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use instance(Class<T> type, Annotation... qualifiers)
instead? You have DataSourceLiteral
for this purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
a69e05e
to
b836d84
Compare
This workflow status is outdated as a new workflow run has been triggered. Failing Jobs - Building b836d84
Failures⚙️ Initial JDK 11 Build #- Failing: extensions/agroal/runtime
! Skipped: devtools/bom-descriptor-json docs extensions/agroal/deployment and 137 more 📦 extensions/agroal/runtime✖ |
b836d84
to
e585673
Compare
Fixes #20950