public void unregisterFhirServer ( FhirServer server , Map < String , Object > props ) throws FhirConfigurationException { if ( server != null ) { String serverName = ( String ) props . get ( FhirServer . SVCPROP_SERVICE_NAME ) ; if ( serverName != null ) { FhirServer service = registeredServers . get ( serverName ) ; if ( service != null ) { log . trace ( "Unregistering FHIR Server [" + serverName + "]" ) ; service . unregisterOsgiProviders ( ) ; registeredServers . remove ( serverName ) ; log . trace ( "Dequeue any FHIR providers waiting for this server" ) ; pendingProviders . remove ( serverName ) ; if ( registeredServers . size ( ) == 0 ) { log . trace ( "Dequeue any FHIR providers waiting for the first/only server" ) ; pendingProviders . remove ( FIRST_SERVER ) ; } Collection < Collection < Object > > providers = serverProviders . get ( serverName ) ; if ( providers != null ) { serverProviders . remove ( serverName ) ; registeredProviders . removeAll ( providers ) ; } } } else { throw new FhirConfigurationException ( "FHIR Server registered in OSGi is missing the required [" + FhirServer . SVCPROP_SERVICE_NAME + "] service-property" ) ; } } }
This method will be called when a FHIR Server OSGi service is being removed from the container . This normally will only occur when its bundle is stopped because it is being removed or updated .