Runnable task = (Runnable)iter.next(); task.run();
TxCallback callback = (TxCallback)iter.next(); callback.afterCommit();
   public void commit() throws Exception   {      if (state == STATE_ROLLBACK_ONLY)      {         throw new TransactionException("Transaction marked rollback only, cannot commit");      }      if (log.isTraceEnabled()) { log.trace("committing " + this); }      //TODO - commit the tx in the database            state = STATE_COMMITTED;            if (insertedTXRecord)      {         if (pm == null)         {            throw new IllegalStateException("Reliable messages were handled in the transaction, but there is no persistence manager!");         }         pm.commitTx(this);      }            Iterator iter = postCommitTasks.iterator();      while (iter.hasNext())      {         Runnable task = (Runnable)iter.next();         task.run();      }   }