Search in sources :

Example 1 with ProxyRequestMetadataSetupContext

use of com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestMetadataSetupContext in project pinpoint by naver.

the class ProxyRequestTypeRegistryServiceImpl method init.

@PostConstruct
public void init() {
    final ClassLoader classLoader = ClassUtils.getDefaultClassLoader();
    final ServiceLoader<ProxyRequestMetadataProvider> serviceLoader = ServiceLoader.load(ProxyRequestMetadataProvider.class, classLoader);
    final List<ProxyRequestType> proxyRequestTypeList = new ArrayList<ProxyRequestType>();
    for (ProxyRequestMetadataProvider provider : serviceLoader) {
        final ProxyRequestMetadataSetupContext context = new ProxyRequestMetadataSetupContext() {

            @Override
            public void addProxyHttpHeaderType(ProxyRequestType type) {
                proxyRequestTypeList.add(type);
            }
        };
        provider.setup(context);
    }
    logger.info("Loading ProxyRequestTypeProvider {}", proxyRequestTypeList);
    for (ProxyRequestType type : proxyRequestTypeList) {
        logger.info("Add ProxyRequestType {}", type);
        final ProxyRequestType exist = this.codeLookupTable.put(type.getCode(), type);
        if (exist != null) {
            logger.warn("Duplicated ProxyRequestType {}/{}", type, exist);
        }
    }
}
Also used : ProxyRequestMetadataSetupContext(com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestMetadataSetupContext) ProxyRequestType(com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestType) ProxyRequestMetadataProvider(com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestMetadataProvider) ArrayList(java.util.ArrayList) PostConstruct(javax.annotation.PostConstruct)

Aggregations

ProxyRequestMetadataProvider (com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestMetadataProvider)1 ProxyRequestMetadataSetupContext (com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestMetadataSetupContext)1 ProxyRequestType (com.navercorp.pinpoint.agent.plugin.proxy.common.ProxyRequestType)1 ArrayList (java.util.ArrayList)1 PostConstruct (javax.annotation.PostConstruct)1