示例#1
0
  /** {@inheritDoc} */
  @Override
  public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(id);

    boolean writable = innerSplit instanceof Writable;

    out.writeUTF(writable ? innerSplit.getClass().getName() : null);

    if (writable) ((Writable) innerSplit).write(out);
    else out.writeObject(innerSplit);
  }
  /** {@inheritDoc} */
  @Override
  public void writeExternal(ObjectOutput out) throws IOException {
    U.writeByteArray(out, src);

    out.writeInt(depMode.ordinal());

    U.writeGridUuid(out, clsLdrId);
    U.writeString(out, srcClsName);
    U.writeString(out, userVer);
    U.writeMap(out, ldrParties);
  }
  /**
   * @param out Object output.
   * @throws IOException If failed.
   */
  @SuppressWarnings("TypeMayBeWeakened")
  private void writeFieldsCollection(ObjectOutput out) throws IOException {
    assert fields;

    out.writeInt(data != null ? data.size() : -1);

    if (data == null) return;

    for (Object o : data) {
      List<GridIndexingEntity<?>> list = (List<GridIndexingEntity<?>>) o;

      out.writeInt(list.size());

      for (GridIndexingEntity<?> idxEnt : list) {
        try {
          out.writeObject(idxEnt.value());
        } catch (GridSpiException e) {
          throw new IOException("Failed to write indexing entity: " + idxEnt, e);
        }
      }
    }
  }