public void takeSnapshot ( SnapshotWriter writer ) { log . debug ( "Taking snapshot {}" , writer . snapshot ( ) . index ( ) ) ; // Serialize sessions to the in-memory snapshot and request a snapshot from the state machine. writer . writeLong ( primitiveId . id ( ) ) ; writer . writeString ( primitiveType . name ( ) ) ; writer . writeString ( serviceName ) ; writer . writeLong ( currentIndex ) ; writer . writeLong ( currentTimestamp ) ; writer . writeLong ( timestampDelta ) ; writer . writeInt ( sessions . getSessions ( ) . size ( ) ) ; for ( RaftSession session : sessions . getSessions ( ) ) { writer . writeLong ( session . sessionId ( ) . id ( ) ) ; writer . writeString ( session . memberId ( ) . id ( ) ) ; writer . writeString ( session . readConsistency ( ) . name ( ) ) ; writer . writeLong ( session . minTimeout ( ) ) ; writer . writeLong ( session . maxTimeout ( ) ) ; writer . writeLong ( session . getLastUpdated ( ) ) ; writer . writeLong ( session . getRequestSequence ( ) ) ; writer . writeLong ( session . getCommandSequence ( ) ) ; writer . writeLong ( session . getEventIndex ( ) ) ; writer . writeLong ( session . getLastCompleted ( ) ) ; } service . backup ( new DefaultBackupOutput ( writer , service . serializer ( ) ) ) ; }
Takes a snapshot of the service state .