Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #52 from corcorb/NOREF-log-connection-close-failure
Browse files Browse the repository at this point in the history
Log ConnectionBasedStatementExecutor#closeConnection failures

Logging-only change; self-merging.
  • Loading branch information
corcorb committed Apr 19, 2016
2 parents 9fd76f6 + 9630e1d commit 3a0deec
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -2,6 +2,8 @@

import com.google.common.base.Preconditions;
import com.google.common.base.Throwables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;
import java.sql.SQLException;
Expand All @@ -22,6 +24,7 @@
* @author ivan.german
*/
public class ConnectionBasedStatementExecutor implements StatementExecutor {
private static final Logger LOG = LoggerFactory.getLogger(ConnectionBasedStatementExecutor.class);

private final Connection connection;

Expand Down Expand Up @@ -54,6 +57,7 @@ public void closeConnection() {
}
catch (SQLException e) {
// Ignored exception
LOG.warn("Exception while force-closing connection", e);
}
}

Expand All @@ -68,7 +72,8 @@ public <T> T execute(StatementCallback<T> statementCallback) {

try (Statement statement = actualConnection.createStatement()) {
return statementCallback.doInStatement(statement);
} catch (SQLException e) {
}
catch (SQLException e) {
throw Throwables.propagate(e);
}
}
Expand Down

0 comments on commit 3a0deec

Please sign in to comment.