modules/ballerina-core/src/main/java/org/ballerinalang/services/dispatchers/http/HTTPServicesRegistry.java
public void unregisterService(Service service) {
        String listenerInterface = Constants.DEFAULT_INTERFACE;
        // String basePath = Constants.DEFAULT_BASE_PATH;
        String basePath = service.getSymbolName().getName();

        for (Annotation annotation : service.getAnnotations()) {
            if (annotation.getName().equals(Constants.ANNOTATION_NAME_SOURCE)) {
                String sourceInterfaceVal = annotation
                        .getValueOfElementPair(new SymbolName(Constants.ANNOTATION_SOURCE_KEY_INTERFACE));
                if (sourceInterfaceVal != null) {   //TODO: Filter non-http protocols
                    listenerInterface = sourceInterfaceVal;
                }
            } else if (annotation.getName().equals(
                    Constants.PROTOCOL_HTTP + ":" + Constants.ANNOTATION_NAME_BASE_PATH)) {
                basePath = annotation.getValue();
            }
        }


        if (!basePath.startsWith(Constants.DEFAULT_BASE_PATH)) {
            basePath = Constants.DEFAULT_BASE_PATH.concat(basePath);
        }

        Map<String, Service> servicesOnInterface = servicesMap.get(listenerInterface);
        if (servicesOnInterface != null) {
            servicesOnInterface.remove(basePath);
            if (servicesOnInterface.isEmpty()) {
                servicesMap.remove(listenerInterface);
                ServerConnector connector =
                        BallerinaConnectorManager.getInstance().getServerConnector(listenerInterface);
                if (connector != null) {
                    try {
                        connector.stop();
                    } catch (ServerConnectorException e) {
                        throw new BallerinaException("Cannot stop the connector for the interface : " +
                                                             listenerInterface, e);
                    }
                }
            }
        }
    }
/**
     * Removing service from the service registry.
     * @param service requested service to be removed.
     */
Removing service from the service registry.
@param service requested service to be removed.
Removing service from the service registry . @param service requested service to be removed .
public void unregisterService(Service service) {
        String listenerInterface = Constants.DEFAULT_INTERFACE;
        String basePath = service.getSymbolName().getName();
        for (Annotation annotation : service.getAnnotations()) {
            if (annotation.getName().equals(Constants.ANNOTATION_NAME_SOURCE)) {
                String sourceInterfaceVal = annotation
                        .getValueOfElementPair(new SymbolName(Constants.ANNOTATION_SOURCE_KEY_INTERFACE));
                if (sourceInterfaceVal != null) {   
                    listenerInterface = sourceInterfaceVal;
                }
            } else if (annotation.getName().equals(
                    Constants.PROTOCOL_HTTP + ":" + Constants.ANNOTATION_NAME_BASE_PATH)) {
                basePath = annotation.getValue();
            }
        }
        if (!basePath.startsWith(Constants.DEFAULT_BASE_PATH)) {
            basePath = Constants.DEFAULT_BASE_PATH.concat(basePath);
        }
        Map<String, Service> servicesOnInterface = servicesMap.get(listenerInterface);
        if (servicesOnInterface != null) {
            servicesOnInterface.remove(basePath);
            if (servicesOnInterface.isEmpty()) {
                servicesMap.remove(listenerInterface);
                ServerConnector connector =
                        BallerinaConnectorManager.getInstance().getServerConnector(listenerInterface);
                if (connector != null) {
                    try {
                        connector.stop();
                    } catch (ServerConnectorException e) {
                        throw new BallerinaException("Cannot stop the connector for the interface : " +
                                                             listenerInterface, e);
                    }
                }
            }
        }
    }
public void unregisterService ( Service service ) { String listenerInterface = Constants . DEFAULT_INTERFACE ; String basePath = service . getSymbolName ( ) . getName ( ) ; for ( Annotation annotation : service . getAnnotations ( ) ) { if ( annotation . getName ( ) . equals ( Constants . ANNOTATION_NAME_SOURCE ) ) { String sourceInterfaceVal = annotation . getValueOfElementPair ( new SymbolName ( Constants . ANNOTATION_SOURCE_KEY_INTERFACE ) ) ; if ( sourceInterfaceVal != null ) { listenerInterface = sourceInterfaceVal ; } } else if ( annotation . getName ( ) . equals ( Constants . PROTOCOL_HTTP + ":" + Constants . ANNOTATION_NAME_BASE_PATH ) ) { basePath = annotation . getValue ( ) ; } } if ( ! basePath . startsWith ( Constants . DEFAULT_BASE_PATH ) ) { basePath = Constants . DEFAULT_BASE_PATH . concat ( basePath ) ; } Map < String , Service > servicesOnInterface = servicesMap . get ( listenerInterface ) ; if ( servicesOnInterface != null ) { servicesOnInterface . remove ( basePath ) ; if ( servicesOnInterface . isEmpty ( ) ) { servicesMap . remove ( listenerInterface ) ; ServerConnector connector = BallerinaConnectorManager . getInstance ( ) . getServerConnector ( listenerInterface ) ; if ( connector != null ) { try { connector . stop ( ) ; } catch ( ServerConnectorException e ) { throw new BallerinaException ( "Cannot stop the connector for the interface : " + listenerInterface , e ) ; } } } } }
Removing service from the service registry.
Removing service from the service registry .
// String basePath = Constants.DEFAULT_BASE_PATH; //TODO: Filter non-http protocols