super.add(ref, tx);  if (ref.isReliable()) {  if (log.isTraceEnabled()) { log.trace("adding " + ref + (tx == null ? " to database non-transactionally" : " in transaction: " + tx)); } pm.add(channelID, ref, tx); }  if (tx != null) { addAddReferenceTask(tx); if (log.isTraceEnabled()) { log.trace("added an Add task to transaction " + tx); }
synchronized (ref) { super.add(ref, tx);  if (ref.isReliable()) {  if (log.isTraceEnabled()) { log.trace("adding " + ref + (tx == null ? " to database non-transactionally" : " in transaction: " + tx)); } pm.add(channelID, ref, tx); }  if (tx != null) { addAddReferenceTask(tx); if (log.isTraceEnabled()) { log.trace("added an Add task to transaction " + tx); } }
   public void add(MessageReference ref, Transaction tx) throws Throwable   {      super.add(ref, tx);      if (ref.isReliable())      {         //Reliable message in a recoverable state - also add to db         if (log.isTraceEnabled()) { log.trace("adding " + ref + (tx == null ? " to database non-transactionally" : " in transaction: " + tx)); }         pm.add(channelID, ref, tx);      }      if (tx != null)      {         addAddReferenceTask(tx);         if (log.isTraceEnabled()) { log.trace("added an Add task to transaction " + tx); }      }   }