diff --git a/dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/monitoring/metrics/DataSourcePoolMetricsConfig.java b/dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/monitoring/metrics/DataSourcePoolMetricsConfig.java index 9263ecdd64cd..39eb350bdc65 100644 --- a/dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/monitoring/metrics/DataSourcePoolMetricsConfig.java +++ b/dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/monitoring/metrics/DataSourcePoolMetricsConfig.java @@ -99,9 +99,11 @@ private String getDataSourceName(String beanName) { public Collection dataSourceMetadataProvider() { return List.of( dataSource -> { - if (dataSource instanceof ComboPooledDataSource comboPooledDataSource) { + if (dataSource instanceof ComboPooledDataSource) { + ComboPooledDataSource comboPooledDataSource = (ComboPooledDataSource) dataSource; return new C3p0MetadataProvider(comboPooledDataSource); - } else if (dataSource instanceof HikariDataSource hikariDataSource) { + } else if (dataSource instanceof HikariDataSource) { + HikariDataSource hikariDataSource = (HikariDataSource) dataSource; return new HikariMetadataProvider(hikariDataSource); } else { throw new IllegalArgumentException(