Browse Source

Close connection after use in LiquibaseEndpoint

Update LiquibaseEndpoint so that connections are closed and returned to
the pool after use.

Fixes gh-6118
pull/6184/head
Johannes Edmeier 10 years ago committed by Phillip Webb
parent
commit
e89063cc07
  1. 5
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpoint.java

5
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpoint.java

@ -54,9 +54,14 @@ public class LiquibaseEndpoint extends AbstractEndpoint<List<Map<String, ?>>> { @@ -54,9 +54,14 @@ public class LiquibaseEndpoint extends AbstractEndpoint<List<Map<String, ?>>> {
DatabaseFactory factory = DatabaseFactory.getInstance();
DataSource dataSource = this.liquibase.getDataSource();
JdbcConnection connection = new JdbcConnection(dataSource.getConnection());
try {
Database database = factory.findCorrectDatabaseImplementation(connection);
return service.queryDatabaseChangeLogTable(database);
}
finally {
connection.close();
}
}
catch (Exception ex) {
throw new IllegalStateException("Unable to get Liquibase changelog", ex);
}

Loading…
Cancel
Save