try {
// We get the state back from the job_id parameter. The state is
// serialized and stored in the datastore, so we pass an instance
// of the datastore service.
MapReduceState mrState = MapReduceState.getMapReduceStateFromJobID(
datastore, jobId);
// There's a bit of ceremony to get the actual counter. This
// example is intentionally verbose for clarity. First get all the
// Counters,
// then we get the CounterGroup, then we get the Counter, then we
// get the count.
Counters counters = mrState.getCounters();
CounterGroup counterGroup = counters.getGroup("CommentWords");
Counter counter = counterGroup.findCounter("count");
long wordCount = counter.getValue(); // Finally!
// Let's create a special datastore Entity for this value so