docs: @Override
     public boolean enlistResource(XAResource resource) throws RollbackException, IllegalStateException, SystemException {
        if (trace) {
           log.tracef("Transaction.enlistResource(%s) invoked in transaction with Xid=%s", resource, xid);
        }
        checkStatusBeforeRegister("resource");
  
        //avoid duplicates
        for (Map.Entry<XAResource, Integer> otherResourceEntry : resources) {
           try {
              if (otherResourceEntry.getKey().isSameRM(resource)) {
                 log.debug("Ignoring resource. It is already there.");
                 return true;
              }
           } catch (XAException e) {
              //ignored
           }
        }
  
        resources.add(new AbstractMap.SimpleEntry<>(resource, null));
  
        try {
           if (trace) {
              log.tracef("XaResource.start() invoked in transaction with Xid=%s", xid);
           }
           resource.start(xid, XAResource.TMNOFLAGS);
        } catch (XAException e) {
           if (isRollbackCode(e)) {
              RollbackException exception = newRollbackException(format("Resource %s rolled back the transaction while XaResource.start()", resource), e);
              markRollbackOnly(exception);
              log.errorEnlistingResource(e);
              throw exception;
           }
           log.errorEnlistingResource(e);
           throw new SystemException(e.getMessage());
        }
        return true;
     }