日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

Dubbo服务者

發(fā)布時間:2025/3/21 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Dubbo服务者 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>

創(chuàng)建代理對象

com.alibaba.dubbo.config.ServiceConfig#export

通過消費(fèi)者export()方法可以找到以上方法,消費(fèi)者需要根據(jù)配置的接口生成代理對象。 ###生成Invoker

以上通過工廠生成服務(wù)者的Invoker,Wrapper.getWrapper里面通過接口生成新Wrapper及接口的實(shí)現(xiàn)。 生成的具體代碼 public class AClass$sw1 extends Wrapper {public static String[] pns;public static Map pts;public static String[] mns;public static String[] dmns;public static Class[] mts0;public static Class[] mts1;public AClass$sw1() {}public String[] getPropertyNames(){ return pns; }public boolean hasProperty(String n){ return pts.containsKey(n); }public Class getPropertyType(String n){ return (Class)pts.get(n); }public String[] getMethodNames(){ return mns; }public String[] getDeclaredMethodNames(){ return dmns; }public void setPropertyValue(Object o, String n, Object v){ AClass w; try{ w = ((AClass)o); }catch(Throwable e){ throw new IllegalArgumentException(e); }if( n.equals("field1") ){ w.field1=((Boolean) v).booleanValue(); return; }if( n.equals("field2") ){ w.field2=((Boolean) v).booleanValue(); return; }throw new NoSuchPropertyException("Not found property $2 filed or setter method in class AClass."); }public Object getPropertyValue(Object o, String n){AClass w; try{ w = ((AClass)o); }catch(Throwable e){ throw new IllegalArgumentException(e); }if( n.equals("field1") ){ return ($w)w.field1; }if( n.equals("field2") ){ return ($w)w.field2; }// getField11if( n.equals("field11") ){ return ($w)w.getField11(); }// isField21|hasField21|canField21if( n.equals("field21") ){ return ($w)w.isField21(); }throw new NoSuchPropertyException("Not found property $2 filed or setter method in class AClass."); }public Object invokeMethod(Object o, String n, Class[] p, Object[] v) throws InvocationTargetException {AClass w; try{ w = ((AClass)o); }catch(Throwable e){ throw new IllegalArgumentException(e); }try{if( "method1".equals( n ) && p.length == && p[0].getName().equals("Boolean") && p[1].getName().equals("Integer") ) { return ($w)w.method1(((Boolean)v[0]).booleanValue(), ((Number)v[1]).intValue());}} catch(Throwable e) {throw new java.lang.reflect.InvocationTargetException(e); }throw new NoSuchMethodException("Not found method n in class AClass."); } }

服務(wù)者生成了對應(yīng)的Invoker,通過DubboProtocol暴露Exporter。

轉(zhuǎn)載于:https://my.oschina.net/u/1269959/blog/751755

總結(jié)

以上是生活随笔為你收集整理的Dubbo服务者的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。