java类org.apache.hadoop.io.WritableFactories的实例源码

HadoopInputSplit.java 文件源码 项目:flink 阅读 32 收藏 0 点赞 0 评论 0
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    // read the parent fields and the final fields
    in.defaultReadObject();

    // the job conf knows how to deserialize itself
    jobConf = new JobConf();
    jobConf.readFields(in);

    try {
        hadoopInputSplit = (org.apache.hadoop.mapred.InputSplit) WritableFactories.newInstance(splitType);
    }
    catch (Exception e) {
        throw new RuntimeException("Unable to instantiate Hadoop InputSplit", e);
    }

    if (hadoopInputSplit instanceof Configurable) {
        ((Configurable) hadoopInputSplit).setConf(this.jobConf);
    }
    else if (hadoopInputSplit instanceof JobConfigurable) {
        ((JobConfigurable) hadoopInputSplit).configure(this.jobConf);
    }
    hadoopInputSplit.readFields(in);
}
HadoopInputSplit.java 文件源码 项目:flink 阅读 28 收藏 0 点赞 0 评论 0
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    // read the parent fields and the final fields
    in.defaultReadObject();

    // the job conf knows how to deserialize itself
    jobConf = new JobConf();
    jobConf.readFields(in);

    try {
        hadoopInputSplit = (org.apache.hadoop.mapred.InputSplit) WritableFactories.newInstance(splitType);
    }
    catch (Exception e) {
        throw new RuntimeException("Unable to instantiate Hadoop InputSplit", e);
    }

    if (hadoopInputSplit instanceof Configurable) {
        ((Configurable) hadoopInputSplit).setConf(this.jobConf);
    }
    else if (hadoopInputSplit instanceof JobConfigurable) {
        ((JobConfigurable) hadoopInputSplit).configure(this.jobConf);
    }
    hadoopInputSplit.readFields(in);
}
HadoopInputSplit.java 文件源码 项目:vs.msc.ws14 阅读 25 收藏 0 点赞 0 评论 0
@Override
public void read(DataInputView in) throws IOException {
    this.splitNumber=in.readInt();
    this.hadoopInputSplitTypeName = in.readUTF();
    if(hadoopInputSplit == null) {
        try {
            Class<? extends org.apache.hadoop.io.Writable> inputSplit =
                    Class.forName(hadoopInputSplitTypeName).asSubclass(org.apache.hadoop.io.Writable.class);
            this.hadoopInputSplit = (org.apache.hadoop.mapred.InputSplit) WritableFactories.newInstance( inputSplit );
        }
        catch (Exception e) {
            throw new RuntimeException("Unable to create InputSplit", e);
        }
    }
    jobConf = new JobConf();
    jobConf.readFields(in);
    if (this.hadoopInputSplit instanceof Configurable) {
        ((Configurable) this.hadoopInputSplit).setConf(this.jobConf);
    }
    this.hadoopInputSplit.readFields(in);

}
HadoopInputSplit.java 文件源码 项目:vs.msc.ws14 阅读 25 收藏 0 点赞 0 评论 0
@Override
public void read(DataInputView in) throws IOException {
    this.splitNumber=in.readInt();
    String className = in.readUTF();

    if(this.mapreduceInputSplit == null) {
        try {
            Class<? extends org.apache.hadoop.io.Writable> inputSplit = 
                    Class.forName(className).asSubclass(org.apache.hadoop.io.Writable.class);
            this.mapreduceInputSplit = (org.apache.hadoop.mapreduce.InputSplit) WritableFactories.newInstance(inputSplit);
        } catch (Exception e) {
            throw new RuntimeException("Unable to create InputSplit", e);
        }
    }
    ((Writable)this.mapreduceInputSplit).readFields(in);
}
HadoopInputSplit.java 文件源码 项目:flink 阅读 31 收藏 0 点赞 0 评论 0
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    // read the parent fields and the final fields
    in.defaultReadObject();

    try {
        Class<? extends Writable> writableSplit = splitType.asSubclass(Writable.class);
        mapreduceInputSplit = (org.apache.hadoop.mapreduce.InputSplit) WritableFactories.newInstance(writableSplit);
    }

    catch (Exception e) {
        throw new RuntimeException("Unable to instantiate the Hadoop InputSplit", e);
    }

    ((Writable) mapreduceInputSplit).readFields(in);
}
HadoopInputSplit.java 文件源码 项目:flink 阅读 23 收藏 0 点赞 0 评论 0
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    // read the parent fields and the final fields
    in.defaultReadObject();

    try {
        Class<? extends Writable> writableSplit = splitType.asSubclass(Writable.class);
        mapreduceInputSplit = (org.apache.hadoop.mapreduce.InputSplit) WritableFactories.newInstance(writableSplit);
    }

    catch (Exception e) {
        throw new RuntimeException("Unable to instantiate the Hadoop InputSplit", e);
    }

    ((Writable) mapreduceInputSplit).readFields(in);
}
Classes.java 文件源码 项目:LCIndex-HBase-0.94.16 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Used to dynamically load a filter class, and create a Writable filter.
 * This filter class most likely extends Configurable.
 *
 * @param className the filter class name.
 * @return a filter
 */
public static Filter createWritableForName(String className) {
  try {
    Class<? extends Filter> clazz = getFilterClassByName(className);
    return (Filter)WritableFactories.newInstance(clazz, new Configuration());
  } catch (ClassNotFoundException e) {
    throw new RuntimeException("Can't find class " + className);
  }
}
Classes.java 文件源码 项目:IRIndex 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Used to dynamically load a filter class, and create a Writable filter.
 * This filter class most likely extends Configurable.
 *
 * @param className the filter class name.
 * @return a filter
 */
public static Filter createWritableForName(String className) {
  try {
    Class<? extends Filter> clazz = getFilterClassByName(className);
    return (Filter)WritableFactories.newInstance(clazz, new Configuration());
  } catch (ClassNotFoundException e) {
    throw new RuntimeException("Can't find class " + className);
  }
}
Scan.java 文件源码 项目:RStore 阅读 29 收藏 0 点赞 0 评论 0
@SuppressWarnings("unchecked")
private Writable createForName(String className) {
    try {
        Class<? extends Writable> clazz = (Class<? extends Writable>) Class
                .forName(className);
        return WritableFactories.newInstance(clazz, new Configuration());
    } catch (ClassNotFoundException e) {
        throw new RuntimeException("Can't find class " + className);
    }
}
Get.java 文件源码 项目:RStore 阅读 23 收藏 0 点赞 0 评论 0
@SuppressWarnings("unchecked")
private Writable createForName(String className) {
  try {
    Class<? extends Writable> clazz =
      (Class<? extends Writable>) Class.forName(className);
    return WritableFactories.newInstance(clazz, new Configuration());
  } catch (ClassNotFoundException e) {
    throw new RuntimeException("Can't find class " + className);
  }
}
ClusterLocatorRPCObject.java 文件源码 项目:CSBT 阅读 156 收藏 0 点赞 0 评论 0
@SuppressWarnings("unchecked")
private Writable createForName(String className) {
  try {
    Class<? extends Writable> clazz = (Class<? extends Writable>) Class.forName(className);
    return WritableFactories.newInstance(clazz, new Configuration());
  } catch (ClassNotFoundException e) {
    throw new RuntimeException("Can't find class " + className);
  }
}
Classes.java 文件源码 项目:HBase-Research 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Used to dynamically load a filter class, and create a Writable filter.
 * This filter class most likely extends Configurable.
 *
 * @param className the filter class name.
 * @return a filter
 */
@SuppressWarnings("unchecked")
public static Filter createWritableForName(String className) {
  try {
    Class<? extends Filter> clazz =
      (Class<? extends Filter>) Class.forName(className, true, CLASS_LOADER);
    return (Filter)WritableFactories.newInstance(clazz, new Configuration());
  } catch (ClassNotFoundException e) {
    throw new RuntimeException("Can't find class " + className);
  }
}
Classes.java 文件源码 项目:hbase-0.94.8-qod 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Used to dynamically load a filter class, and create a Writable filter.
 * This filter class most likely extends Configurable.
 *
 * @param className the filter class name.
 * @return a filter
 */
@SuppressWarnings("unchecked")
public static Filter createWritableForName(String className) {
  try {
    Class<? extends Filter> clazz =
      (Class<? extends Filter>) Class.forName(className, true, CLASS_LOADER);
    return (Filter)WritableFactories.newInstance(clazz, new Configuration());
  } catch (ClassNotFoundException e) {
    throw new RuntimeException("Can't find class " + className);
  }
}
Classes.java 文件源码 项目:hbase-0.94.8-qod 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Used to dynamically load a filter class, and create a Writable filter.
 * This filter class most likely extends Configurable.
 *
 * @param className the filter class name.
 * @return a filter
 */
@SuppressWarnings("unchecked")
public static Filter createWritableForName(String className) {
  try {
    Class<? extends Filter> clazz =
      (Class<? extends Filter>) Class.forName(className, true, CLASS_LOADER);
    return (Filter)WritableFactories.newInstance(clazz, new Configuration());
  } catch (ClassNotFoundException e) {
    throw new RuntimeException("Can't find class " + className);
  }
}
Classes.java 文件源码 项目:hindex 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Used to dynamically load a filter class, and create a Writable filter.
 * This filter class most likely extends Configurable.
 *
 * @param className the filter class name.
 * @return a filter
 */
@SuppressWarnings("unchecked")
public static Filter createWritableForName(String className) {
  try {
    Class<? extends Filter> clazz =
      (Class<? extends Filter>) Class.forName(className, true, CLASS_LOADER);
    return (Filter)WritableFactories.newInstance(clazz, new Configuration());
  } catch (ClassNotFoundException e) {
    throw new RuntimeException("Can't find class " + className);
  }
}


问题


面经


文章

微信
公众号

扫码关注公众号