log.trace("Delete " + rows + " rows"); }
log.trace("Delete/updated " + rows + " rows"); }
   public void removeReference(long channelID, MessageReference ref, Transaction tx) throws Exception   {      if (tx != null)      {         //In a tx so we just add the ref in the tx in memory for now         TransactionCallback callback = getCallback(tx);         callback.addReferenceToRemove(channelID, ref);      }      else      {         //No tx so we remove the reference directly from the db         TransactionWrapper wrap = new TransactionWrapper();         PreparedStatement psReference = null;         PreparedStatement psMessage = null;         Connection conn = ds.getConnection();         try         {            psReference = conn.prepareStatement(deleteMessageRef);            //Remove the message reference            removeReference(channelID, ref, psReference);            int rows = psReference.executeUpdate();            if (trace)            {               log.trace("Deleted " + rows + " rows");            }            psMessage = conn.prepareStatement(deleteMessage);            //We may need to remove the message itself            boolean removed = checkRemoveMessage(ref, psMessage);            if (removed)            {               rows = psMessage.executeUpdate();               if (trace)               {                  log.trace("Delete " + rows + " rows");               }            }         }         catch (Exception e)         {            wrap.exceptionOccurred();            throw e;         }         finally         {            if (psReference != null)            {               try               {                  psReference.close();               }               catch (Throwable t)               {               }            }            if (psMessage != null)            {               try               {                  psMessage.close();               }               catch (Throwable t)               {               }            }            if (conn != null)            {               try               {                  conn.close();               }               catch (Throwable t)               {               }            }            wrap.end();         }      }   }