/**
  * Serializations are found by reading the <code>io.serializations</code> property from <code>conf
  * </code>, which is a comma-delimited list of classnames.
  */
 public SerializationFactory(Configuration conf) {
   super(conf);
   for (String serializerName :
       conf.getStrings(
           "io.serializations",
           new String[] {"org.apache.hadoop.io.serializer.WritableSerialization"})) {
     add(conf, serializerName);
   }
 }
  @SuppressWarnings("unchecked")
  private void add(Configuration conf, String serializationName) {
    try {

      Class<? extends Serialization> serializionClass =
          (Class<? extends Serialization>) conf.getClassByName(serializationName);
      serializations.add(ReflectionUtils.newInstance(serializionClass, getConf()));
    } catch (ClassNotFoundException e) {
      LOG.warn("Serilization class not found: " + StringUtils.stringifyException(e));
    }
  }
Пример #3
0
 @Override
 public void setConf(Configuration conf) {
   super.setConf(conf);
   if (conf.get(NUM_ATTRIBUTES) != null) numAttributes = conf.getInt(NUM_ATTRIBUTES, -1);
 }
Пример #4
0
 @Override
 public void initialize(Configuration conf, InputSplit split)
     throws IOException, InterruptedException {
   super.initialize(conf, split);
   if (conf.get(NUM_ATTRIBUTES) != null) numAttributes = conf.getInt(NUM_ATTRIBUTES, -1);
 }
Пример #5
0
 @Override
 public void initialize(Configuration conf) {
   minWordFrequency = conf.getInt(TextVectorizer.MIN_WORD_FREQUENCY, 5);
 }