Exemplo n.º 1
0
  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    id = in.readInt();

    String clsName = in.readUTF();

    if (clsName == null) innerSplit = in.readObject();
    else {
      // Split wrapper only used when classes available in our classpath, so Class.forName is ok
      // here.
      Class<Writable> cls = (Class<Writable>) Class.forName(clsName);

      try {
        innerSplit = U.newInstance(cls);
      } catch (GridException e) {
        throw new IOException(e);
      }

      ((Writable) innerSplit).readFields(in);
    }
  }