@Override public void doDeleteOldMessages(TransactionContext c) throws SQLException, IOException { PreparedStatement s = null; try { LOG.debug("Executing SQL: " + this.statements.getDeleteOldMessagesStatementWithPriority()); s = c.getExclusiveConnection().prepareStatement(this.statements.getDeleteOldMessagesStatementWithPriority()); int priority = priorityIterator++%10; s.setInt(1, priority); s.setInt(2, priority); int i = s.executeUpdate(); LOG.debug("Deleted " + i + " old message(s) at priority: " + priority); } finally { close(s); } }
@Override public void doDeleteOldMessages(TransactionContext c) throws SQLException, IOException { PreparedStatement s = null; try { LOG.debug("Executing SQL: " + this.statements.getDeleteOldMessagesStatementWithPriority()); s = c.getExclusiveConnection().prepareStatement(this.statements.getDeleteOldMessagesStatementWithPriority()); int priority = priorityIterator++%10; s.setInt(1, priority); s.setInt(2, priority); int i = s.executeUpdate(); LOG.debug("Deleted " + i + " old message(s) at priority: " + priority); } finally { close(s); } }
@Override public void doDeleteOldMessages(TransactionContext c) throws SQLException, IOException { PreparedStatement s = null; try { LOG.debug("Executing SQL: " + this.statements.getDeleteOldMessagesStatementWithPriority()); s = c.getExclusiveConnection().prepareStatement(this.statements.getDeleteOldMessagesStatementWithPriority()); int priority = priorityIterator++%10; s.setInt(1, priority); s.setInt(2, priority); int i = s.executeUpdate(); LOG.debug("Deleted " + i + " old message(s) at priority: " + priority); } finally { close(s); } }
@Override public void doDeleteOldMessages(TransactionContext c) throws SQLException, IOException { PreparedStatement s = null; try { LOG.debug("Executing SQL: " + this.statements.getDeleteOldMessagesStatementWithPriority()); s = c.getExclusiveConnection().prepareStatement(this.statements.getDeleteOldMessagesStatementWithPriority()); int priority = priorityIterator++%10; s.setInt(1, priority); s.setInt(2, priority); int i = s.executeUpdate(); LOG.debug("Deleted " + i + " old message(s) at priority: " + priority); } finally { close(s); } }
public void doDeleteOldMessages(TransactionContext c, boolean isPrioritizedMessages) throws SQLException, IOException { PreparedStatement s = null; cleanupExclusiveLock.writeLock().lock(); try { if (isPrioritizedMessages) { LOG.debug("Executing SQL: " + this.statements.getDeleteOldMessagesStatementWithPriority()); s = c.getConnection().prepareStatement(this.statements.getDeleteOldMessagesStatementWithPriority()); } else { LOG.debug("Executing SQL: " + this.statements.getDeleteOldMessagesStatement()); s = c.getConnection().prepareStatement(this.statements.getDeleteOldMessagesStatement()); } s.setLong(1, System.currentTimeMillis()); int i = s.executeUpdate(); LOG.debug("Deleted " + i + " old message(s)."); } finally { cleanupExclusiveLock.writeLock().unlock(); close(s); } }