Search in sources :

Example 1 with ReferenceAnnotationBeanPostProcessor

use of org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor in project dubbo by alibaba.

the class DubboReferencesMetadata method references.

public Map<String, Map<String, Object>> references() {
    Map<String, Map<String, Object>> referencesMetadata = new LinkedHashMap<>();
    ReferenceAnnotationBeanPostProcessor beanPostProcessor = getReferenceAnnotationBeanPostProcessor();
    referencesMetadata.putAll(buildReferencesMetadata(beanPostProcessor.getInjectedFieldReferenceBeanMap()));
    referencesMetadata.putAll(buildReferencesMetadata(beanPostProcessor.getInjectedMethodReferenceBeanMap()));
    return referencesMetadata;
}
Also used : ReferenceAnnotationBeanPostProcessor(org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with ReferenceAnnotationBeanPostProcessor

use of org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor in project dubbo by alibaba.

the class DubboShutdownMetadata method shutdown.

public Map<String, Object> shutdown() throws Exception {
    Map<String, Object> shutdownCountData = new LinkedHashMap<>();
    // registries
    int registriesCount = getRegistries().size();
    // protocols
    int protocolsCount = getProtocolConfigsBeanMap().size();
    shutdownCountData.put("registries", registriesCount);
    shutdownCountData.put("protocols", protocolsCount);
    // Service Beans
    Map<String, ServiceBean> serviceBeansMap = getServiceBeansMap();
    if (!serviceBeansMap.isEmpty()) {
        for (ServiceBean serviceBean : serviceBeansMap.values()) {
            serviceBean.destroy();
        }
    }
    shutdownCountData.put("services", serviceBeansMap.size());
    // Reference Beans
    ReferenceAnnotationBeanPostProcessor beanPostProcessor = getReferenceAnnotationBeanPostProcessor();
    int referencesCount = beanPostProcessor.getReferenceBeans().size();
    beanPostProcessor.destroy();
    shutdownCountData.put("references", referencesCount);
    // Set Result to complete
    Map<String, Object> shutdownData = new TreeMap<>();
    shutdownData.put("shutdown.count", shutdownCountData);
    return shutdownData;
}
Also used : ReferenceAnnotationBeanPostProcessor(org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor) ServiceBean(org.apache.dubbo.config.spring.ServiceBean) TreeMap(java.util.TreeMap) LinkedHashMap(java.util.LinkedHashMap)

Example 3 with ReferenceAnnotationBeanPostProcessor

use of org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor in project incubator-dubbo-spring-boot-project by apache.

the class DubboReferencesMetadata method references.

public Map<String, Map<String, Object>> references() {
    Map<String, Map<String, Object>> referencesMetadata = new LinkedHashMap<>();
    ReferenceAnnotationBeanPostProcessor beanPostProcessor = getReferenceAnnotationBeanPostProcessor();
    referencesMetadata.putAll(buildReferencesMetadata(beanPostProcessor.getInjectedFieldReferenceBeanMap()));
    referencesMetadata.putAll(buildReferencesMetadata(beanPostProcessor.getInjectedMethodReferenceBeanMap()));
    return referencesMetadata;
}
Also used : ReferenceAnnotationBeanPostProcessor(org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap)

Example 4 with ReferenceAnnotationBeanPostProcessor

use of org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor in project incubator-dubbo-spring-boot-project by apache.

the class DubboShutdownMetadata method shutdown.

public Map<String, Object> shutdown() throws Exception {
    Map<String, Object> shutdownCountData = new LinkedHashMap<>();
    // registries
    int registriesCount = getRegistries().size();
    // protocols
    int protocolsCount = getProtocolConfigsBeanMap().size();
    shutdownCountData.put("registries", registriesCount);
    shutdownCountData.put("protocols", protocolsCount);
    // Service Beans
    Map<String, ServiceBean> serviceBeansMap = getServiceBeansMap();
    if (!serviceBeansMap.isEmpty()) {
        for (ServiceBean serviceBean : serviceBeansMap.values()) {
            serviceBean.destroy();
        }
    }
    shutdownCountData.put("services", serviceBeansMap.size());
    // Reference Beans
    ReferenceAnnotationBeanPostProcessor beanPostProcessor = getReferenceAnnotationBeanPostProcessor();
    int referencesCount = beanPostProcessor.getReferenceBeans().size();
    beanPostProcessor.destroy();
    shutdownCountData.put("references", referencesCount);
    // Set Result to complete
    Map<String, Object> shutdownData = new TreeMap<>();
    shutdownData.put("shutdown.count", shutdownCountData);
    return shutdownData;
}
Also used : ReferenceAnnotationBeanPostProcessor(org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor) ServiceBean(org.apache.dubbo.config.spring.ServiceBean) TreeMap(java.util.TreeMap) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

LinkedHashMap (java.util.LinkedHashMap)4 ReferenceAnnotationBeanPostProcessor (org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor)4 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 ServiceBean (org.apache.dubbo.config.spring.ServiceBean)2