javaweb
javaweb copied to clipboard
http://www1350.github.io/
分析完了服务提供者,紧接着分析消费者。 从ReferenceBean入手 ## Config层 ### ReferenceBean ```java public void afterPropertiesSet() throws Exception { //init consumerConfig //... //init applicationConfig //init moduleConfig //init registryConfigs //init monitorConfig Boolean b = isInit(); if (b...
serialize层 dubbo的序列化方式包括:hessian2、fastjson、fst、jdk、kryo 只要通过配置`` 或`` 就可以实现 ```java @SPI("hessian2") public interface Serialization { /** * get content type id * * @return content type id */ byte getContentTypeId(); /** * get content...
本篇将着重分析dubbo的remoting模块 ## exchange 信息交换层 ### Exchangers(门面) ```java public class Exchangers { static { // check duplicate jar package Version.checkDuplicate(Exchangers.class); } private Exchangers() { } public static ExchangeServer bind(String url, Replier...
## 什么是Dubbo? Dubbo是阿里巴巴公司开源的一个高性能优秀的服务框架,使得应用可通过高性能的RPC实现服务的输出和输入功能,以及SOA服务治理方案,和spring框架无缝集成。 dubbo作为一个非常好的rpc项目,广泛在国内使用。 官网:http://dubbo.incubator.apache.org/ github地址:https://github.com/apache/incubator-dubbo 我们先看下项目结构:  模块说明: - **dubbo-common 公共逻辑模块**:包括 Util 类和通用模型。 - **dubbo-remoting 远程通讯模块**:相当于 Dubbo 协议的实现,如果 RPC 用 RMI协议则不需要使用此包。 - **dubbo-rpc 远程调用模块**:抽象各种协议,以及动态代理,只包含一对一的调用,不关心集群的管理。 - **dubbo-cluster 集群模块**:将多个服务提供方伪装为一个提供方,包括:负载均衡, 容错,路由等,集群的地址列表可以是静态配置的,也可以是由注册中心下发。 -...
# 脚本分析 mqbroker.sh ``` #!/bin/sh if [ -z "$ROCKETMQ_HOME" ] ; then ## resolve links - $0 may be a link to maven's home PRG="$0" # need this for relative...
## rocketMQ通信模块  NettyRemotingClient ``` @Override public void start() { //业务线程池 this.defaultEventExecutorGroup = new DefaultEventExecutorGroup( nettyClientConfig.getClientWorkerThreads(), new ThreadFactory() { private AtomicInteger threadIndex = new AtomicInteger(0); @Override public Thread newThread(Runnable r)...
不同版本jdk实现都不太一样。 关于1.6 http://ifeve.com/java-concurrent-hashmap-1/ http://ifeve.com/java-concurrent-hashmap-2/ http://www.importnew.com/16147.html 为什么ConcurrentHashMap是弱一致的? (注意这是jdk1.6,1.7、1.8都不是弱一致了) http://ifeve.com/concurrenthashmap-weakly-consistent/ 关于1.7 http://www.blogjava.net/DLevin/archive/2013/10/18/405030.html 关于1.7和1.8区别 http://www.importnew.com/23610.html 接下来我们来分析1.8源码 先看下类的层次结构  ```java public class ConcurrentHashMap extends AbstractMap implements ConcurrentMap, Serializable { //最大容量不得超过1 e; return ((o instanceof...
我们看到最早的解析,是解析xml ``` ``` # StandardServer  ## StandardServer(LifecycleBase)的init ``` @Override public final synchronized void init() throws LifecycleException { if (!state.equals(LifecycleState.NEW)) { invalidTransition(Lifecycle.BEFORE_INIT_EVENT); } setStateInternal(LifecycleState.INITIALIZING, null, false); try { initInternal(); }...
1.redis数据结构 # 简单字符串 redis专门封装了一个叫SDS的数据结构 ``` struct sdshdr { // 记录 buf 数组中已使用字节的数量 // 等于 SDS 所保存字符串的长度 int len; // 记录 buf 数组中未使用字节的数量 int free; // 字节数组,用于保存字符串 char buf[]; }; ```...
入门使用 :http://rocketmq.apache.org/docs/quick-start/ Download & Build from Release Click here to download the 4.2.0 source release. Also you could download a binary release from here. Now execute the following commands to...