private void installService ( SnapshotReader reader ) { PrimitiveId primitiveId = PrimitiveId . from ( reader . readLong ( ) ) ; try { PrimitiveType primitiveType = raft . getPrimitiveTypes ( ) . getPrimitiveType ( reader . readString ( ) ) ; String serviceName = reader . readString ( ) ; byte [ ] serviceConfig = reader . readBytes ( reader . readInt ( ) ) ; // Get or create the service associated with the snapshot. logger . debug ( "Installing service {} {}" , primitiveId , serviceName ) ; RaftServiceContext service = initializeService ( primitiveId , primitiveType , serviceName , serviceConfig ) ; if ( service != null ) { try { service . installSnapshot ( reader ) ; } catch ( Exception e ) { logger . error ( "Failed to install snapshot for service {}" , serviceName , e ) ; } } } catch ( ConfigurationException e ) { logger . error ( e . getMessage ( ) , e ) ; } }
Restores the service associated with the given snapshot .