private EnumId allocateEnumId(EnumInfo ei) {
    TXStateProxy currentState = suspendTX();
    Region<Object, Object> r = getIdToType();

    int id = ei.hashCode() & PLACE_HOLDER_FOR_TYPE_ID;
    int newEnumId = id | typeIdPrefix;
    try {
      int maxTry = MAX_TYPE_ID;
      // Find the next available type id.
      while (r.get(new EnumId(newEnumId)) != null) {
        maxTry--;
        if (maxTry == 0) {
          throw new InternalGemFireError(
              "Used up all of the PDX type ids for this distributed system. The maximum number of PDX types is "
                  + MAX_TYPE_ID);
        }

        // Find the next available type id.
        id++;
        if (id > MAX_TYPE_ID) {
          id = 1;
        }
        newEnumId = id | typeIdPrefix;
      }

      return new EnumId(newEnumId);
    } finally {
      resumeTX(currentState);
    }
  }
The region where the PDX metadata is stored. Because this region is transactional for our
internal updates but we don't want to participate in the users transactions, all operations on
this region must suspend any existing transactions with suspendTX/resumeTX.
geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java