class SubtaskExecutionAttemptAccumulatorsHandler extends AbstractSubtaskAttemptRequestHandler {

	public static String createAttemptAccumulatorsJson(AccessExecution execAttempt) throws IOException {
		StringWriter writer = new StringWriter();
		JsonGenerator gen = JsonFactory.JACKSON_FACTORY.createGenerator(writer);

		final StringifiedAccumulatorResult[] accs = execAttempt.getUserAccumulatorsStringified();

		gen.writeStartObject();

		gen.writeNumberField("subtask", execAttempt.getParallelSubtaskIndex());
		gen.writeNumberField("attempt", execAttempt.getAttemptNumber());
		gen.writeStringField("id", execAttempt.getAttemptId().toString());

		gen.writeArrayFieldStart("user-accumulators");
		for (StringifiedAccumulatorResult acc : accs) {
			gen.writeStartObject();
			gen.writeStringField("name", acc.getName());
			gen.writeStringField("type", acc.getType());
			gen.writeStringField("value", acc.getValue());
			gen.writeEndObject();
		}
		gen.writeEndArray();

		gen.writeEndObject();

		gen.close();
		return writer.toString();
	}

	public  SubtaskExecutionAttemptAccumulatorsHandler(ExecutionGraphCache executionGraphHolder, Executor executor);

}