摘要: 假设场景 有10件商品,同时来30个人并发购买,不加锁的情况下会超出现超卖,加上lock锁后就防止了超卖 带着问题看源码 1. ReentrantLock是怎么加锁和解锁的 2. ReentrantLock是怎么实现可重入的 ReentrantLock是怎么加锁的? ReentrantLock lo 阅读全文
posted @ 2020-04-14 15:01 鹿慕叶 阅读(443) 评论(0) 推荐(0) 编辑
摘要: ``` java public class NamesrvController { private static final InternalLogger log = InternalLoggerFactory.getLogger(LoggerName.NAMESRV_LOGGER_NAME); private final NamesrvConfig namesrvConfig;... 阅读全文
posted @ 2018-08-17 20:31 鹿慕叶 阅读(412) 评论(0) 推荐(0) 编辑
摘要: ```java public class NamesrvStartup { private static InternalLogger log; private static Properties properties = null; private static CommandLine commandLine = null; public static voi... 阅读全文
posted @ 2018-08-11 14:49 鹿慕叶 阅读(271) 评论(0) 推荐(0) 编辑
摘要: cap理论 阅读全文
posted @ 2018-07-27 14:37 鹿慕叶 阅读(341) 评论(0) 推荐(0) 编辑
摘要: 起因 crontab中的定时任务,执行到关闭tomcat时,报环境变量找不到 解决方案 1.使用 . /etc/profile 引入环境变量 推荐, 实测ubuntu12 成功 2.使用 source /etc/profile 引入环境变量 不推荐,实测ubuntu12 失败 注意 . /etc/p 阅读全文
posted @ 2017-06-29 16:20 鹿慕叶 阅读(1180) 评论(0) 推荐(0) 编辑
摘要: 原脚本代码 shell !/bin/bash cd ~/home/work/hours RESP= if [ "$RESP" == "Already up to date." ];then echo "already up to date" ~/home/logs/deploy.log else e 阅读全文
posted @ 2017-06-29 13:25 鹿慕叶 阅读(3034) 评论(0) 推荐(0) 编辑
摘要: 起因 这是今天我线上出了一个bug,需要查看日志并统计一个我需要的信息出现的频率,可以叫做分组统计。 日志文件部分内容 目的 统计每个shopId出现的错误的次数 方案 使用awk的分组统计 awk代码 部分统计效果如下 ··· 800599961375 273 800599958609 4 800 阅读全文
posted @ 2017-06-27 18:04 鹿慕叶 阅读(931) 评论(0) 推荐(0) 编辑
摘要: 任务:report.txt文件里有以下内容:记录了一些方法的执行时间,要求按执行时间降序排列. 1 void com.dustpan.zeus.core.service.MergeService.startService(int)|2 2 void com.dustpan.zeus.core.ser 阅读全文
posted @ 2016-09-11 18:08 鹿慕叶 阅读(8104) 评论(0) 推荐(0) 编辑