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