code: private void finish(boolean commit)
     {
        for (Synchronization s : syncs)
        {
           s.beforeCompletion();
        }
  
        if (commit)
        {
           status = Status.STATUS_COMMITTED;
        }
        else
        {
           status = Status.STATUS_ROLLEDBACK;
        }
  
        for (Synchronization s : syncs)
        {
           s.afterCompletion(status);
        }
  
        status = Status.STATUS_UNKNOWN;
        syncs.clear();
        resources.clear();
     }
docs: Finish transaction
  @param commit Commit (true), or rollback (false)