void install ( Snapshot snapshot ) { logger . debug ( "Installing snapshot {}" , snapshot ) ; try ( SnapshotReader reader = snapshot . openReader ( ) ) { while ( reader . hasRemaining ( ) ) { try { int length = reader . readInt ( ) ; if ( length > 0 ) { SnapshotReader serviceReader = new SnapshotReader ( reader . buffer ( ) . slice ( length ) , reader . snapshot ( ) ) ; installService ( serviceReader ) ; reader . skip ( length ) ; } } catch ( Exception e ) { logger . error ( "Failed to read snapshot" , e ) ; } } } }
Prepares sessions for the given index .