@Override
  public void serialize(DataOutputStream stream) throws IOException {
    stream.writeShort(ProcedureType.REMOVE_DATA_NODE_PROCEDURE.getTypeCode());
    super.serialize(stream);
    stream.writeInt(removedDataNodes.size());
    removedDataNodes.forEach(
        dataNode -> ThriftCommonsSerDeUtils.serializeTDataNodeLocation(dataNode, stream));
    stream.writeInt(regionMigrationPlans.size());
    for (RegionMigrationPlan regionMigrationPlan : regionMigrationPlans) {
      regionMigrationPlan.serialize(stream);
    }
    stream.writeInt(nodeStatusMap.size());
    for (Map.Entry<Integer, NodeStatus> entry : nodeStatusMap.entrySet()) {
      stream.writeInt(entry.getKey());
      stream.writeByte(entry.getValue().ordinal());
    }
  }
Used to keep procedure lock even when the procedure is yielded or suspended.

@param env env
@return true if hold the lock
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/node/RemoveDataNodesProcedure.java