task = new AddReferenceTask(tx); txToAddReferenceTasks.put(tx, task); tx.addPostCommitTask(task);
calback = new AddReferenceCallback(tx); txToAddReferenceTasks.put(tx, calback); tx.addCallback(calback);
   protected AddReferenceTask addAddReferenceTask(Transaction tx)   {                  //TODO we could avoid this lookup by letting the tx object store the AddReferenceTask      AddReferenceTask task = (AddReferenceTask)txToAddReferenceTasks.get(tx);      if (task == null)      {         task = new AddReferenceTask(tx);         txToAddReferenceTasks.put(tx, task);         tx.addPostCommitTask(task);      }      return task;   }