Skip to content

Commit

Permalink
Refactor ShardingSphereStatisticsRefreshEngine (#33883)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Dec 2, 2024
1 parent 60fae79 commit b799a53
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ private void collectAndRefresh() {
}
}

private void collectForDatabase(final String databaseName, final ShardingSphereDatabaseData databaseData,
final ShardingSphereMetaData metaData, final ShardingSphereStatistics statistics) {
private void collectForDatabase(final String databaseName, final ShardingSphereDatabaseData databaseData, final ShardingSphereMetaData metaData, final ShardingSphereStatistics statistics) {
for (Entry<String, ShardingSphereSchemaData> entry : databaseData.getSchemaData().entrySet()) {
if (metaData.getDatabase(databaseName).containsSchema(entry.getKey())) {
collectForSchema(databaseName, entry.getKey(), entry.getValue(), metaData, statistics);
Expand All @@ -122,11 +121,11 @@ private void collectForSchema(final String databaseName, final String schemaName

private void collectForTable(final String databaseName, final String schemaName, final ShardingSphereTable table,
final ShardingSphereMetaData metaData, final ShardingSphereStatistics statistics) {
Optional<ShardingSphereStatisticsCollector> dataCollector = TypedSPILoader.findService(ShardingSphereStatisticsCollector.class, table.getName());
Optional<ShardingSphereStatisticsCollector> statisticsCollector = TypedSPILoader.findService(ShardingSphereStatisticsCollector.class, table.getName());
Optional<ShardingSphereTableData> tableData = Optional.empty();
if (dataCollector.isPresent()) {
if (statisticsCollector.isPresent()) {
try {
tableData = dataCollector.get().collect(databaseName, table, metaData.getDatabases(), contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData());
tableData = statisticsCollector.get().collect(databaseName, table, metaData.getDatabases(), metaData.getGlobalRuleMetaData());
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
Expand Down

0 comments on commit b799a53

Please sign in to comment.