int numOwnVertices = 0;
JSONParser parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE);
while (value.hasNext()) {
Text vrecString = value.next();
JSONObject obj;
try {
obj = (JSONObject) parser.parse(vrecString.toString());
int owner = ((Long) obj.get("owner")).intValue();
if (owner == key.get()) {
numOwnVertices++;
reporter.incrCounter(COUNTER.OWN_VERTICES, 1);
}
out.collect(new Text("partition" + key.get() + " vrecord"), vrecString);
numVertices++;
reporter.incrCounter(COUNTER.VERTICES, 1);
} catch (ParseException e) {
e.printStackTrace();
} // end try parsing
} // end while
JSONObject summary = new JSONObject();
summary.put("numVertices", numVertices);
summary.put("numOwnVertices", numOwnVertices);
out.collect(new Text("partition" + key.get() + " meta"),
new Text(summary.toJSONString()));
}