private void filter(Message msg, int direction) {
    if (direction == INCOMING) {
      Header h = msg.getHeader(frag2HeaderId);
      boolean copyBuffer = false;
      if (h != null && h instanceof FragHeader) {
        copyBuffer = true;
      } else {
        h = msg.getHeader(unicastHeaderId);
        if (h instanceof UNICAST3.Header) {
          copyBuffer = true;
        } else {
          h = msg.getHeader(nakackHeaderId);
          if (h instanceof NakAckHeader2) {
            copyBuffer = true;
          }
        }
      }
      if (copyBuffer) {
        // JGroups doesn't copy its message buffer when thread pools are
        // disabled. This causes Frag2 fragments to become corrupted
        msg.setBuffer(msg.getBuffer(), 0, msg.getLength());
      }
    }
  }
sets the services object of the GMS that is using this recorder

@param services the Services collective of the GMS
geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/messenger/StatRecorder.java