/**
   * {@inheritDoc}
   *
   * @param ctx
   */
  @Override
  public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
    super.prepareMarshal(ctx);

    GridCacheContext cctx = ctx.cacheContext(cacheId);

    prepareMarshalCacheObjects(keys, cctx);

    if (op == TRANSFORM) entryProcessorsBytes = marshalCollection(entryProcessors, ctx);
    else prepareMarshalCacheObjects(vals, cctx);

    if (filter != null) {
      boolean hasFilter = false;

      for (CacheEntryPredicate p : filter) {
        if (p != null) {
          hasFilter = true;

          p.prepareMarshal(cctx);
        }
      }

      if (!hasFilter) filter = null;
    }

    invokeArgsBytes = marshalInvokeArguments(invokeArgs, ctx);

    if (expiryPlc != null)
      expiryPlcBytes = CU.marshal(ctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
  }
  /** {@inheritDoc} */
  @Override
  public void finishUnmarshal(GridCacheContext<K, V> ctx, ClassLoader ldr) throws GridException {
    super.finishUnmarshal(ctx, ldr);

    if (errBytes != null) err = ctx.marshaller().unmarshal(errBytes, ldr);

    metadata = unmarshalCollection(metaDataBytes, ctx, ldr);
    data =
        fields
            ? unmarshalFieldsCollection(dataBytes, ctx, ldr)
            : unmarshalCollection(dataBytes, ctx, ldr);
  }
  /** {@inheritDoc} */
  @Override
  protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
    super.clone0(_msg);

    GridCacheQueryResponse _clone = (GridCacheQueryResponse) _msg;

    _clone.finished = finished;
    _clone.reqId = reqId;
    _clone.err = err;
    _clone.errBytes = errBytes;
    _clone.fields = fields;
    _clone.metaDataBytes = metaDataBytes;
    _clone.metadata = metadata;
    _clone.dataBytes = dataBytes;
    _clone.data = data;
  }
  /** {@inheritDoc} */
  @Override
  public void prepareMarshal(GridCacheContext<K, V> ctx) throws GridException {
    super.prepareMarshal(ctx);

    if (err != null) errBytes = ctx.marshaller().marshal(err);

    metaDataBytes = marshalCollection(metadata, ctx);
    dataBytes = fields ? marshalFieldsCollection(data, ctx) : marshalCollection(data, ctx);

    if (ctx.deploymentEnabled() && !F.isEmpty(data)) {
      for (Object o : data) {
        if (o instanceof Map.Entry) {
          Map.Entry e = (Map.Entry) o;

          prepareObject(e.getKey(), ctx);
          prepareObject(e.getValue(), ctx);
        }
      }
    }
  }
  /** {@inheritDoc} */
  @Override
  public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr)
      throws IgniteCheckedException {
    super.finishUnmarshal(ctx, ldr);

    GridCacheContext cctx = ctx.cacheContext(cacheId);

    finishUnmarshalCacheObjects(keys, cctx, ldr);

    if (op == TRANSFORM) entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
    else finishUnmarshalCacheObjects(vals, cctx, ldr);

    if (filter != null) {
      for (CacheEntryPredicate p : filter) {
        if (p != null) p.finishUnmarshal(cctx, ldr);
      }
    }

    invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);

    if (expiryPlcBytes != null) expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, ldr);
  }