@ Override public void addInstanceChangeListener ( String serviceName , ServiceInstanceChangeListener listener ) throws ServiceException { ServiceInstanceUtils . validateManagerIsStarted ( isStarted . get ( ) ) ; ServiceInstanceUtils . validateServiceName ( serviceName ) ; if ( listener == null ) { throw new ServiceException ( ErrorCode . SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR , ErrorCode . SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR . getMessageTemplate ( ) , "ServiceInstanceChangeListener" ) ; } ModelService service = getLookupService ( ) . getModelService ( serviceName ) ; if ( service == null ) { throw new ServiceException ( ErrorCode . SERVICE_DOES_NOT_EXIST , ErrorCode . SERVICE_DOES_NOT_EXIST . getMessageTemplate ( ) , serviceName ) ; } getLookupService ( ) . addServiceInstanceChangeListener ( serviceName , listener ) ; }
Add a ServiceInstanceChangeListener to the Service .