Skip to content

Commit

Permalink
[0.10.0-SNAPSHOT]
Browse files Browse the repository at this point in the history
Potential connection double close for LiquibaseJdbcMigrationEngine fixed
  • Loading branch information
GoodforGod committed Apr 14, 2024
1 parent 4a90864 commit 547d61f
Showing 1 changed file with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,16 @@ public void apply(@NotNull List<String> locations) {
getClass().getSimpleName(), jdbcConnection);

try {
try (Connection connection = jdbcConnection.openConnection()) {
try (var database = getLiquiDatabase(connection)) {
migrateLiquibase(database, locations);
}
Connection connection = jdbcConnection.openConnection();
try (var database = getLiquiDatabase(connection)) {
migrateLiquibase(database, locations);
}
} catch (Exception e) {
try {
Thread.sleep(250);
try (Connection connection = jdbcConnection.openConnection()) {
try (var database = getLiquiDatabase(connection)) {
migrateLiquibase(database, locations);
}
Connection connection = jdbcConnection.openConnection();
try (var database = getLiquiDatabase(connection)) {
migrateLiquibase(database, locations);
}
} catch (Exception ex) {
logger.error("Failed migration apply for engine '{}' for connection: {}",
Expand All @@ -125,18 +123,16 @@ public void drop(@NotNull List<String> locations) {
getClass().getSimpleName(), jdbcConnection);

try {
try (Connection connection = jdbcConnection.openConnection()) {
try (var database = getLiquiDatabase(connection)) {
dropLiquibase(database, locations);
}
Connection connection = jdbcConnection.openConnection();
try (var database = getLiquiDatabase(connection)) {
dropLiquibase(database, locations);
}
} catch (Exception e) {
try {
Thread.sleep(250);
try (Connection connection = jdbcConnection.openConnection()) {
try (var database = getLiquiDatabase(connection)) {
dropLiquibase(database, locations);
}
Connection connection = jdbcConnection.openConnection();
try (var database = getLiquiDatabase(connection)) {
dropLiquibase(database, locations);
}
} catch (Exception ex) {
logger.error("Failed migration drop for engine '{}' for connection: {}",
Expand Down

0 comments on commit 547d61f

Please sign in to comment.