9月 112020
 

说明

本文基于Apache Kafka 2.5.1(2020.09.10拉取最新代码)

Consumer如何使用?

阅读源码前的首先要做到熟悉相关组件的概念、基本使用。而最靠谱的资料就是官方文档。

建议阅读官方文档(https://kafka.apache.org/documentation/)后,自己练习、使用kafka之后再开始阅读源码。 Continue reading »

7月 242020
 

按官方提示https://github.com/naver/pinpoint-docker ,通过docker安装pinpoint时,遇到端口冲突问题

 docker-compose up -d                                                                                                                                                                                             
Creating network "pinpoint-docker_pinpoint" with driver "bridge"                                                                                                                                                   
Creating pinpoint-docker_zoo3_1    ... done                                                                                                                                                                        
Creating pinpoint-docker_zoo2_1    ... done                                                                                                                                                                        
Creating pinpoint-flink-jobmanager ... done                                                                                                                                                                        
Creating pinpoint-docker_zoo1_1     ... done                                                                                                                                                                       
Creating pinpoint-mysql             ... done                                                                                                                                                                       
Creating pinpoint-hbase             ... error                                                                                                                                                                      
Creating pinpoint-flink-taskmanager ... done                                                                                                                                                                       
                                                                                                                                                                                                                   
ERROR: for pinpoint-hbase  Cannot start service pinpoint-hbase: Ports are not available: listen tcp 0.0.0.0:2180: bind: An attempt was made to access a socket in a way forbidden by its access permissions.       
                                                                                                                                                                                                                   
ERROR: for pinpoint-hbase  Cannot start service pinpoint-hbase: Ports are not available: listen tcp 0.0.0.0:2180: bind: An attempt was made to access a socket in a way forbidden by its access permissions.       
Encountered errors while bringing up the project.                                                                                                                                                                  

根据官方提示,修改pinpoint-docker文件夹下的.env文件,修改hbase端口即可,比如我修改为了12180 Continue reading »

10月 222019
 

讲分布式Id生成的文章很多,其中雪花算法也提到过多次,本文不再赘述,只是给出资源汇总,仅供参考。

snowflake-snowflake-2010

twitter原版,scala编写,地址:https://github.com/twitter-archive/snowflake

java版本snowflake

代码源地址 参见

  • https://github.com/beyondfengyu/SnowFlake
  • https://github.com/souyunku/SnowFlake

Leaf——美团点评分布式ID生成系统

介绍参见Leaf——美团点评分布式ID生成系统 https://tech.meituan.com/2017/04/21/mt-leaf.html
代码参见https://github.com/Meituan-Dianping/Leaf
9月 132019
 

课程链接

课程:https://url.163.com/VD8

java锁

synchronized

在jdk 1.5以后,优化了,使其性能并不是像很多帖子说的那样,“非常重”

JUC lock

方法 说明
lock() 获取锁,如果锁被暂用则一直等待
tryLock() 如果获取锁的时候锁被占用就返回false,否则返回true
tryLock(long time, TimeUnit unit) 比起tryLock,多出等待时间
unLock()
lockInterruptibly()

Continue reading »