Skip to content

Commit

Permalink
Close statement first, then the connection
Browse files Browse the repository at this point in the history
  • Loading branch information
wendigo committed Nov 8, 2024
1 parent 2d4c746 commit c1e75e0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.SQLNonTransientException;
import java.sql.SQLRecoverableException;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -231,8 +232,7 @@ public CompletableFuture<Collection<Slice>> finish()
public void abort()
{
// rollback and close
try (Connection connection = this.connection;
PreparedStatement statement = this.statement) {
try (PreparedStatement statement = this.statement; Connection connection = this.connection) {
// skip rollback if implicitly closed due to an error
if (!connection.isClosed()) {
connection.rollback();
Expand Down

0 comments on commit c1e75e0

Please sign in to comment.