ref.acquireReference();
   public void add(MessageReference ref, Transaction tx) throws Throwable   {      if (log.isTraceEnabled()) { log.trace(this + " adding " + ref + (tx == null ? " non-transactionally" : " in transaction: " + tx)); }      if (tx == null)      {         if (ref.isReliable() && !acceptReliableMessages)         {            throw new IllegalStateException("Reliable reference " + ref +                                            " cannot be added to non-recoverable state");         }         messageRefs.addLast(ref, ref.getPriority());                  if (log.isTraceEnabled()) { log.trace(this + " added " + ref + " in memory"); }         return;      }      // transactional add      if (ref.isReliable() && !acceptReliableMessages)      {         // this transaction has no chance to succeed, since a reliable message cannot be         // safely stored by a non-recoverable state, so doom the transaction         if (log.isTraceEnabled()) { log.trace(this + " cannot handle reliable messages, dooming the transaction"); }         tx.setRollbackOnly();      }      else      {         //Transactional so add to post commit callback         AddReferenceCallback callback = addAddReferenceCallback(tx);         callback.addReference(ref);         if (log.isTraceEnabled()) { log.trace(this + " added transactionally " + ref + " in memory"); }      }   }