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); }
@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); }
@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); }
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); }
/** * 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); } }
@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); } }
@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); } }
/** * 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); } }