protected void setup(Context context)
throws IOException, InterruptedException {
super.setup(context);
interestfile = context.getConfiguration().get("interestfile");
Configuration conf = new Configuration();
SequenceFile.Reader sfr = null;
try {
FileSystem fs = FileSystem.get(URI.create(interestfile), conf);
try {
sfr = new SequenceFile.Reader(fs, new Path(interestfile), conf);
Writable k = (Writable) ReflectionUtils.newInstance(sfr.getKeyClass(), conf);
Writable v = (Writable) ReflectionUtils.newInstance(sfr.getValueClass(), conf);
while (sfr.next(k, v)) {
userCate.put(k.toString(),v.toString());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
IOUtils.closeStream(sfr);
}
} catch (IOException e) {
e.printStackTrace();
}
}