// to serialize it and if there's an issue, we include the class name
// of the offending operation in the error. Otherwise it can be time
// consuming to track down which operation is causing problems.
try {
ObjectSerializer objectSerializer = HadoopUtil.instantiateSerializer(jobConf, operation.getClass());
try {
objectSerializer.serialize(operation, true);
} catch (ObjectStreamException e) {
throw new RuntimeException("Could not serialize operation: " + operation.getClass().getCanonicalName(), e);
} catch (IOException e) {
throw new RuntimeException("Error while trying to serialize: " + operation.getClass().getCanonicalName(), e);
}