@ Override public boolean persistState ( ) { if ( ! safeMode ) { LOG . info ( "Cannot persist state because ClusterManager is not in Safe Mode" ) ; return false ; } try { JsonGenerator jsonGenerator = CoronaSerializer . createJsonGenerator ( conf ) ; jsonGenerator . writeStartObject ( ) ; jsonGenerator . writeFieldName ( "startTime" ) ; jsonGenerator . writeNumber ( startTime ) ; jsonGenerator . writeFieldName ( "nodeManager" ) ; nodeManager . write ( jsonGenerator ) ; jsonGenerator . writeFieldName ( "sessionManager" ) ; sessionManager . write ( jsonGenerator ) ; jsonGenerator . writeFieldName ( "sessionNotifier" ) ; sessionNotifier . write ( jsonGenerator ) ; jsonGenerator . writeEndObject ( ) ; jsonGenerator . close ( ) ; } catch ( IOException e ) { LOG . info ( "Could not persist the state: " , e ) ; return false ; } return true ; }
This function saves the state of the ClusterManager to disk .