code: public void write(JsonGenerator jsonGenerator) throws IOException {
      jsonGenerator.writeStartObject();
      // retiredSessions and numRetiredSessions need not be persisted
  
      // sessionCounter can be set to 0, when the SessionManager is instantiated
  
      // sessions begins
      jsonGenerator.writeFieldName("sessions");
      jsonGenerator.writeStartObject();
      for (String sessionId : sessions.keySet()) {
        jsonGenerator.writeFieldName(sessionId);
        sessions.get(sessionId).write(jsonGenerator);
      }
      jsonGenerator.writeEndObject();
      // sessions ends
  
      jsonGenerator.writeNumberField("sessionCounter",
                                      sessionCounter.longValue());
  
      jsonGenerator.writeEndObject();
  
      // We can rebuild runnableSessions
      // No need to write startTime and numRetiredSessions
    }
docs: Used to write the state of the SessionManager instance to disk, when we
  are persisting the state of the ClusterManager
  @param jsonGenerator The JsonGenerator instance being used to write JSON
  to disk
  @throws IOException