com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler Java Examples

The following examples show how to use com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler. 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: MythJdkProxyFactory.java    From myth with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public <T> T getProxy(final Invoker<T> invoker, final Class<?>[] interfaces) {
    T proxy = (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
            interfaces, new InvokerInvocationHandler(invoker));
    return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
            interfaces, new MythInvokerInvocationHandler(proxy, invoker));
}
 
Example #2
Source File: BeanFactoryUtil.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
	// <dubbo:reference id="client" interface="me.cungu.transactiontreetest.case3.Client" />
	Object handlerFieldValue = getFieldValue(bean, "handler");
	if (handlerFieldValue != null && handlerFieldValue instanceof InvokerInvocationHandler) {
		InvokerInvocationHandler invokerInvocationHandler = (InvokerInvocationHandler) handlerFieldValue;
		Object invokerFieldValue = getFieldValue(invokerInvocationHandler, "invoker");
		if (invokerFieldValue != null && invokerFieldValue instanceof MockClusterInvoker<?>) {
			RegistryDirectory<?> directoryFieldValue = (RegistryDirectory<?>) getFieldValue(invokerFieldValue, "directory");
			Map<String, ?> urlInvokerMap = directoryFieldValue.getUrlInvokerMap();
			if (urlInvokerMap != null) {
				for(Map.Entry<String, ?> entry : urlInvokerMap.entrySet()) {
					Object invoker = getFieldValue(entry.getValue(), "invoker");
					Object invoker0 = getFieldValue(invoker, "invoker"); // ListenerInvokerWrapper
					
					beanNameMap.put((invoker0 != null ? invoker0 : invoker ).toString(), beanName); //  interface me.cungu.transactiontreetest.case3.Client -> dubbo://10.144.33.31:20880/me.cungu.transactiontreetest.case3.Client?anyhost=true&application=me.cungu.transactiontree&check=false&default.check=false&default.delay=-1&delay=-1&dubbo=2.5.5.cat-SNAPSHOT&generic=false&interface=me.cungu.transactiontreetest.case3.Client&logger=slf4j&methods=m1_confirm,m1,r1_cannel&pid=8336&providerside=me.cungu.transactiontree&side=consumer&timestamp=1451379561390
					
					LOG.debug("添加beanName={}", beanName);
				}
			}
		} else {
			// TODO
			throw new UnsupportedOperationException(invokerFieldValue.getClass() + " unknow type");
		}
	}
	
	return bean;
}
 
Example #3
Source File: JdkProxyFactory.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
@Override
    @SuppressWarnings("unchecked")
    public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) {
//        服务调用入口=》
        return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, new InvokerInvocationHandler(invoker));
    }
 
Example #4
Source File: JavassistProxyFactory.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) {
    return (T) Proxy.getProxy(interfaces).newInstance(new InvokerInvocationHandler(invoker));
}
 
Example #5
Source File: JdkProxyFactory.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) {
    return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, new InvokerInvocationHandler(invoker));
}
 
Example #6
Source File: JavassistProxyFactory.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) {
    return (T) Proxy.getProxy(interfaces).newInstance(new InvokerInvocationHandler(invoker));
}
 
Example #7
Source File: JdkProxyFactory.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) {
    return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, new InvokerInvocationHandler(invoker));
}
 
Example #8
Source File: JavassistProxyFactory.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) {
    return (T) Proxy.getProxy(interfaces).newInstance(new InvokerInvocationHandler(invoker));
}
 
Example #9
Source File: JdkProxyFactory.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) {
    return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, new InvokerInvocationHandler(invoker));
}
 
Example #10
Source File: JavassistProxyFactory.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) {
    return (T) Proxy.getProxy(interfaces).newInstance(new InvokerInvocationHandler(invoker));
}
 
Example #11
Source File: JdkProxyFactory.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) {
    return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, new InvokerInvocationHandler(invoker));
}
 
Example #12
Source File: JavassistProxyFactory.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) {
    return (T) Proxy.getProxy(interfaces).newInstance(new InvokerInvocationHandler(invoker));
}
 
Example #13
Source File: JdkProxyFactory.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) {
    return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, new InvokerInvocationHandler(invoker));
}
 
Example #14
Source File: JavassistProxyFactory.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) {
    return (T) Proxy.getProxy(interfaces).newInstance(new InvokerInvocationHandler(invoker));
}