code: public void write(JsonGenerator jsonGenerator) throws IOException {
      jsonGenerator.writeStartObject();
  
      int totalSessionsToCtx = 0, totalDeletedSessions = 0;
      for (int i = 0; i < numNotifierThreads; i++) {
        totalSessionsToCtx += notifierThreads[i].sessionsToCtx.size();
        totalDeletedSessions += notifierThreads[i].deletedSessions.size();
      }
  
      jsonGenerator.writeNumberField("totalSessionsToCtx",
                                      totalSessionsToCtx);
  
      jsonGenerator.writeFieldName("sessionsToCtx");
      jsonGenerator.writeStartObject();
      for (int i = 0; i < numNotifierThreads; i++) {
        for (ConcurrentMap.Entry<String, SessionNotificationCtx> entry :
          notifierThreads[i].sessionsToCtx.entrySet()) {
          jsonGenerator.writeFieldName(entry.getKey());
          entry.getValue().write(jsonGenerator);
        }
      }
      jsonGenerator.writeEndObject();
  
      jsonGenerator.writeNumberField("totalDeletedSessions",
                                      totalDeletedSessions);
  
      jsonGenerator.writeFieldName("deletedSessions");
      jsonGenerator.writeStartArray();
      for (int i = 0; i < numNotifierThreads; i++) {
        for (String deletedSessionHandle :
              notifierThreads[i].deletedSessions.keySet()) {
          jsonGenerator.writeString(deletedSessionHandle);
        }
      }
      jsonGenerator.writeEndArray();
  
      jsonGenerator.writeEndObject();
    }
docs: Used to write the state of the SessionNotifier 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