/** * Close all JDBC objects related to this connection. */ public void close() { if (transac_open) { try { this._cnx.rollback(); } catch (Exception e) { // Ignore. } } for (Statement s : toClose) { closeQuietly(s); } toClose.clear(); closeQuietly(_cnx); _cnx = null; }
/** * Close all JDBC objects related to this connection. */ public void close() { if (transac_open) { try { this._cnx.rollback(); } catch (Exception e) { // Ignore. } } for (Statement s : toClose) { closeQuietly(s); } toClose.clear(); closeQuietly(_cnx); _cnx = null; }
void runRawUpdate(String query_sql) { transac_open = true; Statement s = null; String sql = null; try { sql = parent.getAdapter().adaptSql(query_sql); if (sql.trim().isEmpty()) { return; } jqmlogger.debug(sql); s = _cnx.createStatement(); s.executeUpdate(sql); } catch (SQLException e) { throw new DatabaseException(sql, e); } finally { closeQuietly(s); } }
void runRawUpdate(String query_sql) { transac_open = true; Statement s = null; String sql = null; try { sql = parent.getAdapter().adaptSql(query_sql); if (sql.trim().isEmpty()) { return; } jqmlogger.debug(sql); s = _cnx.createStatement(); s.executeUpdate(sql); } catch (SQLException e) { throw new DatabaseException(sql, e); } finally { closeQuietly(s); } }
cnx.closeQuietly(rs);
@Override BookingStatus bookResource(JobInstance ji, DbConn cnx) { if (!ji.getJD().isHighlander()) { // Non-highlander JI do not need anything from this RM. return BookingStatus.BOOKED; } // Lock the definition in the DB - this is a convention for highlander JI between clients and engine. ResultSet rs = cnx.runSelect(true, "jd_select_by_id", ji.getJD().getId()); // We have the lock. Check if there are already running instances. Integer runningCount = cnx.runSelectSingle("ji_select_existing_highlander_2", Integer.class, ji.getJD().getId()); if (runningCount != 0) { // Already running, so skip this JI. cnx.closeQuietly(rs); // release the lock. return BookingStatus.FAILED; } // If here, no running instance and lock is held (release by commit done in the QP, rs is closed with connection). return BookingStatus.BOOKED; } }
@Override BookingStatus bookResource(JobInstance ji, DbConn cnx) { if (!ji.getJD().isHighlander()) { // Non-highlander JI do not need anything from this RM. return BookingStatus.BOOKED; } // Lock the definition in the DB - this is a convention for highlander JI between clients and engine. ResultSet rs = cnx.runSelect(true, "jd_select_by_id", ji.getJD().getId()); // We have the lock. Check if there are already running instances. Integer runningCount = cnx.runSelectSingle("ji_select_existing_highlander_2", Integer.class, ji.getJD().getId()); if (runningCount != 0) { // Already running, so skip this JI. cnx.closeQuietly(rs); // release the lock. return BookingStatus.FAILED; } // If here, no running instance and lock is held (release by commit done in the QP, rs is closed with connection). return BookingStatus.BOOKED; } }