package dk.thoerup.circuitbreaker.invocations; import java.sql.PreparedStatement; import java.sql.Statement; import dk.thoerup.circuitbreaker.CircuitInvocation; public class SQLUpdateInvocation implements CircuitInvocation { PreparedStatement pStatement = null; Statement statement = null; String sql = null; public SQLUpdateInvocation(Statement stmt, String sql) { this.statement = stmt; this.sql = sql; } public SQLUpdateInvocation(PreparedStatement pstmt) { pStatement = pstmt; } public Integer proceed() throws Exception { int rows; if (pStatement != null) { rows = pStatement.executeUpdate(); } else { rows = statement.executeUpdate(sql); } return rows; } }