tx.addPostCommitTask(new PostAcknowledgeCommitTask(touple));
tx.addCallback(new PostAcknowledgeCommitTask(touple));
   public void acknowledge(Routable r, Transaction tx) throws Throwable   {      Object[] touple = null;      SingleReceiverDelivery d = null;      for (Iterator i = messages.iterator(); i.hasNext(); )      {         Object[] o = (Object[])i.next();         Message m = (Message)o[0];         if (m == r)         {            d = (SingleReceiverDelivery)o[1];            touple = o;            break;         }      }      if (touple == null)      {         throw new IllegalStateException("The message " + r + "hasn't been received yet!");      }      if (d == null)      {         throw new IllegalStateException("The message " + r +" has already been acknowledged!");      }      d.acknowledge(tx);      // make sure I get rid of message if the transaction is rolled back      if (tx != null)      {         tx.addPostCommitTask(new PostAcknowledgeCommitTask(touple));      }   }