private int allocateTypeId(PdxType newType) {
    TXStateProxy currentState = suspendTX();
    Region<Object, Object> r = getIdToType();

    int id = newType.hashCode() & PLACE_HOLDER_FOR_TYPE_ID;
    int newTypeId = id | typeIdPrefix;

    try {
      int maxTry = MAX_TYPE_ID;
      while (r.get(newTypeId) != 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;
        }
        newTypeId = id | typeIdPrefix;
      }

      return newTypeId;
    } 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