AddReferenceCallback callback = new AddReferenceCallback(ref); tx.addCallback(callback); if (trace) { log.trace(this + " added transactionally " + ref + " in memory"); }
synchronized (refLock) { ref.setOrdering(getNextReferenceOrdering()); AddReferenceCallback callback = new AddReferenceCallback(ref); tx.addCallback(callback); if (trace) { log.trace(this + " added transactionally " + ref + " in memory"); } }
   public void addReference(MessageReference ref, Transaction tx) throws Throwable   {      if (trace) { log.trace(this + " adding " + ref + "transactionally in transaction: " + tx); }      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 (trace) { log.trace(this + " cannot handle reliable messages, dooming the transaction"); }         tx.setRollbackOnly();      }      else      {         //add to post commit callback         AddReferenceCallback callback = new AddReferenceCallback(ref);         tx.addCallback(callback);         if (trace) { log.trace(this + " added transactionally " + ref + " in memory"); }      }              if (recoverable && ref.isReliable())      {                  //Reliable message in a recoverable state - also add to db         if (trace) { log.trace("adding " + ref + (tx == null ? " to database non-transactionally" : " in transaction: " + tx)); }         pm.addReference(channel.getChannelID(), ref, tx);               }                   }