![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
apache dubbo 2.7.3
_jan_
这个作者很懒,什么都没留下…
展开
-
apache dubbo 2.7.3 源代码片段 - 内置的Filter
// org.apache.dubbo.rpc.Filter // dubbo-config/dubbo-config-api/META-INF/services/org.apache.dubbo.rpc.Filter // mockfilter=org.apache.dubbo.config.mock.MockFilter // 支持unknown; // // dubbo-filter/dubbo-filter-cache/META-INF/dubbo/internal/org.apa...原创 2021-02-05 17:37:21 · 215 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码片段 - Protocol扩展的Listener机制
org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper public class ProtocolListenerWrapper implements Protocol { private final Protocol protocol; public ProtocolListenerWrapper(Protocol protocol) { if (protocol == null) { ...原创 2021-02-03 14:57:05 · 116 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码片段 - Protocol扩展的Filter机制
org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper public class ProtocolFilterWrapper implements Protocol { private final Protocol protocol; public ProtocolFilterWrapper(Protocol protocol) { if (protocol == null) { throw ne原创 2021-02-03 14:51:04 · 165 阅读 · 0 评论 -
seata 1.4.0 - seataServer之处理行级锁
1、在seataClient要进行提交事务的时候,会发送BranchRegisterRequest消息(包含要修改的 资源、表、主键id)到seataServer。 2、seataServer根据客户端传递的消息(资源、表、主键id),插入数据到lock_table表,如果插入的与预期的一直,表示锁成功,否则锁失败,响应的seataClient提交不成功,进而全局事务进行回滚。 io.seata.server.storage.db.lock.LockStoreDataBaseDAO#acquire.原创 2021-01-25 17:44:45 · 924 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码片段 - Protocol扩展的3三个重要Wrapper
ProtocolListenerWrapper(用于支持Listener机制) /** * 用于处理监听,监听exported、unexport调用,不处理registry协议 */ static class ProtocolListenerWrapper_ extends ProtocolListenerWrapper { public ProtocolListenerWrapper_(Protocol protocol) { super(protocol); ...原创 2021-01-25 17:36:47 · 173 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码片段 - 使用CompletableFuture
package cn.java.dubbo.demo.internal; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.StringUtils; import org.apache.dubbo.remoting.Channel; import org.apache.dubbo.remoting.RemotingException; import org.apache.dubbo.remoting.exc...原创 2021-01-21 15:22:16 · 146 阅读 · 4 评论 -
apache dubbo 2.7.3 源代码片段 - dubbo传递异常
dubbo server 如何处理异常 // 捕获异常 // org.apache.dubbo.rpc.proxy.AbstractProxyInvoker#invoke public Result invoke(Invocation invocation) throws RpcException { try { Object value = doInvoke(proxy, invocation.getMethodName(), invocation.getParamete...原创 2021-01-21 14:43:08 · 251 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码片段 - dubbo这样映射请求响应关系
每次请求都都会生成一个reqId,并把关系维护在FUTURES,在请求时把reqId放入请求帧中发送到服务端,服务端在响应的时候会把改请求帧放回到响应帧,并发送到客户端,客户端会根据该reqId从FUTURES获取。 请求 org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeChannel#request(java.lang.Object, int) org.apache.dubbo.remoting.exchange..原创 2021-01-21 10:56:06 · 154 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码片段 - dubbo帧协议
org.apache.dubbo.rpc.protocol.dubbo.DubboCodec org.apache.dubbo.remoting.exchange.codec.ExchangeCodec#decode(org.apache.dubbo.remoting.Channel, org.apache.dubbo.remoting.buffer.ChannelBuffer, int, byte[]) @Override protected Object decode(Channel channe原创 2021-01-20 15:03:19 · 111 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码片段 - client匹配providerUrl
org.apache.dubbo.common.utils.UrlUtils#isMatch public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); /...原创 2021-01-20 11:08:55 · 80 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码片段 - 获取类实现的版本号
// Dubbo implementation version, usually is jar version. private static final String VERSION = getVersion(Version.class, ""); org.apache.dubbo.common.Version#getVersion(java.lang.Class<?>, java.lang.String) public static String getVersion(Cla...原创 2020-12-30 16:44:30 · 202 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码片段 - lambda & 其他
orElseGet ConfigManager.getInstance().getDefaultProtocols() .filter(CollectionUtils::isNotEmpty) .orElseGet(() -> { ProtocolConfig protocolConfig = new ProtocolConfig(); protocolConfig.refresh(); return new ArrayList<>(Arrays.asList(原创 2020-12-30 16:06:01 · 100 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码 - 读取类的版本
org.apache.dubbo.common.Version#getVersion(java.lang.Class<?>, java.lang.String) public static String getVersion(Class<?> cls, String defaultVersion) { try { // find version info from MANIFEST.MF first Packa...原创 2020-09-06 23:45:13 · 221 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码 - 动态编译
org.apache.dubbo.common.extension.ExtensionLoader#createAdaptiveExtensionClass private Class<?> createAdaptiveExtensionClass() { /* 生成 Adaptive 代码 cachedDefaultName == type上@SPI 注解的值 */ String cod...原创 2020-09-06 01:03:16 · 152 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码 - 扩展机制 - 动态生成Adaptive(适配器)
1、每个扩展有且仅有一个Adaptive类 2、在调用ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); 3、获取Adaptive对象的时候: 1、如果获取不到,会动态生成一个,生成的规则是 1、自动实现扩展接口类中的方法 1、方法上的@Adaptive注解的值,最为key 2、获取扩展接口类@SPI注解的值,作为默认参数 ..原创 2020-09-06 01:01:37 · 106 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码 - 扩展机制
扩展类,有3种类型 1、类含有 @Adaptive 注解,那么这个类是 cachedAdaptiveClass 2、类是包装类(含有构造函数&构造函数参数只有一个&参数类型是目标类,如Protocol),那么这个类是 cachedWrapperClasses 3、普通扩展类型 org.apache.dubbo.common.extension.ExtensionLoader#getExtensionLoader 1、一种扩展类型,有且只能有一个类含有 @Ad..原创 2020-09-05 01:13:45 · 256 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码 - 获取绑定监听的地址
org.apache.dubbo.config.ServiceConfig#findConfigedHosts // if bind ip is not found in environment, keep looking up if (StringUtils.isEmpty(hostToBind)) { hostToBind = protocolConfig.getHost(); if (provider != null &&a.原创 2020-09-04 23:52:59 · 189 阅读 · 0 评论 -
apache dubbo 2.7.3 源代码 - 使用 javassist 动态生成类
org.apache.dubbo.common.bytecode.Wrapper#makeWrapper private static Wrapper makeWrapper(Class<?> c) { if (c.isPrimitive()) { throw new IllegalArgumentException("Can not create wrapper for primitive type: " + c); } ...原创 2020-09-04 23:47:00 · 184 阅读 · 0 评论