public PdxType defineType(PdxType newType) {
    Integer existingId = typeToId.get(newType);
    if (existingId != null) {
      PdxType existingType = idToType.get(existingId);
      if (existingType != null) {
        return existingType;
      }
    }

    int id = distributedTypeRegistry.defineType(newType);
    PdxType oldType = idToType.get(id);
    if (oldType == null) {
      newType.setTypeId(id);
      idToType.put(id, newType);
      typeToId.put(newType, id);
      if (logger.isInfoEnabled()) {
        logger.info("Caching {}", newType.toFormattedString());
      }
      return newType;
    } else {
      if (!oldType.equals(newType)) {
        Assert.fail("Old type does not equal new type for the same id. oldType=" + oldType
            + " new type=" + newType);
      }
      return oldType;
    }
  }
Create a type id for a type that may come locally, or from a remote member.

@return the existing type or the new type
geode-core/src/main/java/org/apache/geode/pdx/internal/TypeRegistry.java