com.alibaba.dubbo.config.utils.ReferenceConfigCache Java Examples

The following examples show how to use com.alibaba.dubbo.config.utils.ReferenceConfigCache. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DubboServiceFactory.java    From pampas with Apache License 2.0 6 votes vote down vote up
public Object genericInvoke(DubboRequest dubboRequest) {

        ReferenceConfig<GenericService> reference = new ReferenceConfig<>();
        reference.setApplication(application);
        reference.setRegistry(registry);
        reference.setInterface(dubboRequest.getService());
        reference.setGeneric(true);
        ReferenceConfigCache cache = ReferenceConfigCache.getCache();
        GenericService genericService = cache.get(reference);

        int len = dubboRequest.getParams().size();
        String[] invokeParamTyeps = new String[len];
        Object[] invokeParams = new Object[len];
        for (int i = 0; i < len; i++) {
            invokeParamTyeps[i] = String.valueOf(dubboRequest.getParams().getJSONObject(i).getString("type"));
            invokeParams[i] = dubboRequest.getParams().getJSONObject(i).get("value");
        }
        return genericService.$invoke(dubboRequest.getMethod(), invokeParamTyeps, invokeParams);

    }
 
Example #2
Source File: DubboAutoConfiguration.java    From SkyEye with GNU General Public License v3.0 5 votes vote down vote up
@Bean
public DubboService dubboService(ApplicationConfig applicationConfig, RegistryConfig registryConfig, ProtocolConfig protocolConfig, ReferenceConfigCache referenceConfigCache) {
    if (null == protocolConfig) {
        return new DubboService(applicationConfig, registryConfig, this.dubboProperties, referenceConfigCache);
    }
    return new DubboService(applicationConfig, registryConfig, protocolConfig, this.dubboProperties, referenceConfigCache);
}
 
Example #3
Source File: DubboService.java    From SkyEye with GNU General Public License v3.0 5 votes vote down vote up
public DubboService(ApplicationConfig applicationConfig, RegistryConfig registryConfig, ProtocolConfig protocolConfig, DubboProperties dubboProperties, ReferenceConfigCache referenceConfigCache) {
    this.applicationConfig = applicationConfig;
    this.registryConfig = registryConfig;
    this.protocolConfig = protocolConfig;
    this.dubboProperties = dubboProperties;
    this.referenceConfigCache = referenceConfigCache;
}
 
Example #4
Source File: DubboAutoConfiguration.java    From SkyEye with GNU General Public License v3.0 5 votes vote down vote up
@Bean
public DubboService dubboService(ApplicationConfig applicationConfig, RegistryConfig registryConfig, ProtocolConfig protocolConfig, ReferenceConfigCache referenceConfigCache) {
    if (null == protocolConfig) {
        return new DubboService(applicationConfig, registryConfig, this.dubboProperties, referenceConfigCache);
    }
    return new DubboService(applicationConfig, registryConfig, protocolConfig, this.dubboProperties, referenceConfigCache);
}
 
Example #5
Source File: DubboService.java    From SkyEye with GNU General Public License v3.0 5 votes vote down vote up
public DubboService(ApplicationConfig applicationConfig, RegistryConfig registryConfig, ProtocolConfig protocolConfig, DubboProperties dubboProperties, ReferenceConfigCache referenceConfigCache) {
    this.applicationConfig = applicationConfig;
    this.registryConfig = registryConfig;
    this.protocolConfig = protocolConfig;
    this.dubboProperties = dubboProperties;
    this.referenceConfigCache = referenceConfigCache;
}
 
Example #6
Source File: DubboReferenceInterceptor.java    From nano-framework with Apache License 2.0 5 votes vote down vote up
@Override
protected void inject(final MethodInvocation invocation, final Method method, final Class<?> returnType) throws Throwable {
    final Reference reference = method.getAnnotation(Reference.class);
    final ReferenceConfig<?> refer = new ReferenceConfig<>(reference);
    refer.setCheck(reference.check());
    refer.setInterface(returnType);
    final Object newInstance = ReferenceConfigCache.getCache().get(refer);
    setInstance(invocation.getThis(), method, returnType, newInstance);
}
 
Example #7
Source File: DubboReferenceInjector.java    From nano-framework with Apache License 2.0 5 votes vote down vote up
@Override
public void injectMembers(final T instance) {
    try {
        final Reference reference = field.getAnnotation(Reference.class);
        final ReferenceConfig<?> refer = new ReferenceConfig<>(reference);
        refer.setCheck(reference.check());
        refer.setInterface(field.getType());
        final Object newInstance = ReferenceConfigCache.getCache().get(refer);
        field.set(instance, newInstance);
    } catch (final IllegalAccessException e) {
        throw (Error) new IllegalAccessError(e.getMessage()).initCause(e);
    }
}
 
Example #8
Source File: DubboAutoConfiguration.java    From SkyEye with GNU General Public License v3.0 4 votes vote down vote up
@Bean
public ReferenceConfigCache referenceConfigCache() {
    return ReferenceConfigCache.getCache();
}
 
Example #9
Source File: DubboService.java    From SkyEye with GNU General Public License v3.0 4 votes vote down vote up
public DubboService(ApplicationConfig applicationConfig, RegistryConfig registryConfig, DubboProperties dubboProperties, ReferenceConfigCache referenceConfigCache) {
    this.applicationConfig = applicationConfig;
    this.registryConfig = registryConfig;
    this.dubboProperties = dubboProperties;
    this.referenceConfigCache = referenceConfigCache;
}
 
Example #10
Source File: DubboAutoConfiguration.java    From SkyEye with GNU General Public License v3.0 4 votes vote down vote up
@Bean
public ReferenceConfigCache referenceConfigCache() {
    return ReferenceConfigCache.getCache();
}
 
Example #11
Source File: DubboService.java    From SkyEye with GNU General Public License v3.0 4 votes vote down vote up
public DubboService(ApplicationConfig applicationConfig, RegistryConfig registryConfig, DubboProperties dubboProperties, ReferenceConfigCache referenceConfigCache) {
    this.applicationConfig = applicationConfig;
    this.registryConfig = registryConfig;
    this.dubboProperties = dubboProperties;
    this.referenceConfigCache = referenceConfigCache;
}