public void addStringPart(String str, boolean enableCaching) {
    if (str == null) {
      addRawPart(null, false);
      return;
    }

    Part part = partsList[currentPart];
    if (enableCaching) {
      byte[] bytes = CACHED_STRINGS.get(str);
      if (bytes == null) {
        try (HeapDataOutputStream hdos = new HeapDataOutputStream(str)) {
          bytes = hdos.toByteArray();
          CACHED_STRINGS.put(str, bytes);
        }
      }
      part.setPartState(bytes, false);

    } else {
      // do NOT close the HeapDataOutputStream
      messageModified = true;
      part.setPartState(new HeapDataOutputStream(str), false);
    }
    currentPart++;
  }
When building a Message this will return the number of the next Part to be added to the message
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Message.java