docs: List<DataSlice> encodeFast(Object conn) throws MessageEncodeFailedException {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "encodeFast");
  
      // The 'conn' parameter (if supplied) is passed as an Object (for no good reason except the
      // daft build system), but it has to be a CommsConnection instance.
      if (conn != null && !(conn instanceof CommsConnection)) {
        throw new MessageEncodeFailedException("Incorrect connection object: " + conn.getClass());
      }
  
      // Initial capacity is sufficient for a 2 part message
      List<DataSlice> messageSlices = new ArrayList<DataSlice>(3);
  
      DataSlice slice0  = null;
      DataSlice slice1  = null;
      DataSlice slice2  = null;
  
      // Encoding is handled by JMF.  This will be a very cheap operation if JMF already has the
      // message in assembled form (for example if it was previously decoded from a byte buffer and
      // has had no major changes).
      try {
  
        // We need to check if the receiver has all the necessary schema definitions to be able
        // to decode this message and pre-send any that are missing.
        ensureReceiverHasSchemata((CommsConnection)conn);
  
        // Write the top-level Schema Ids & their versions to the top buffer
        byte[] buff0 = new byte[ IDS_LENGTH + ArrayUtil.INT_SIZE];
        int offset = 0;
        offset += encodeIds(buff0, 0);
        slice0  = new DataSlice(buff0, 0, buff0.length);
  
        // We need to lock the message around the call to updateDataFields() and the
        // actual encode of the part(s), so that noone can update any JMF message data
        // during that time (because they can not get the hdr2, api, or payload part).
        // Otherwise it is possible to get an inconsistent view of the message with some updates
        // included but those to the cached values 'missing'.
        // It is still strictly possible for the top-level schema header fields to be
        // updated, but this will not happen to any fields visible to an app.
        synchronized(theMessage) {
  
          // Next ensure any cached message data is written back before we get the
          // low level (JSMessageImpl) locks                                  d364050
          theMessage.updateDataFields(MfpConstants.UDF_ENCODE);
  
          // Write the second slice - this contains the header
          slice1 = encodeHeaderPartToSlice(headerPart);
  
          // Now we have to tell the buffer in the slice0 how long the header part is
          ArrayUtil.writeInt(buff0, offset, slice1.getLength());
  
          // Now the first 2 slices are complete we can put them in the list.
          // Slices must be added in the correct order.
          messageSlices.add(slice0);
          messageSlices.add(slice1);
  
          // Now for the 3rd slice, which will contain the payload (if there is one)
          if (payloadPart != null) {
            slice2 = encodePayloadPartToSlice(payloadPart, (CommsConnection)conn);
            messageSlices.add(slice2);
          }
        }
  
      }
      catch (MessageEncodeFailedException e1) {
        // This will have been thrown by encodeXxxxxPartToSlice() which will
        // already have dumped the appropriate message part.
        FFDCFilter.processException(e1, "com.ibm.ws.sib.mfp.impl.JsMsgObject.encodeFast", "jmo560", this,
          new Object[] { MfpConstants.DM_MESSAGE, null, theMessage });
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "encodeFast failed: " + e1);
        throw e1;
      }
      catch (Exception e) {
        // This is most likely to be thrown by the getEncodedLength() call on the header
        // so we pass the header part to the diagnostic module.
        FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsMsgObject.encodeFast", "jmo570", this,
          new Object[] { MfpConstants.DM_MESSAGE, headerPart.jmfPart, theMessage });
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "encodeFast failed: " + e);
        throw new MessageEncodeFailedException(e);
      }
  
  
      // If debug trace, dump the message & slices before returning
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Encoded JMF Message", debugMsg());
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Message DataSlices: ", SibTr.formatSlices(messageSlices, MfpDiagnostics.getDiagnosticDataLimitInt()));
  
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "encodeFast");
  
      return messageSlices;
    }