摘要:
假设场景 有10件商品,同时来30个人并发购买,不加锁的情况下会超出现超卖,加上lock锁后就防止了超卖 带着问题看源码 1. ReentrantLock是怎么加锁和解锁的 2. ReentrantLock是怎么实现可重入的 ReentrantLock是怎么加锁的? ReentrantLock lo 阅读全文
摘要:
``` java
public class NamesrvController { private static final InternalLogger log = InternalLoggerFactory.getLogger(LoggerName.NAMESRV_LOGGER_NAME); private final NamesrvConfig namesrvConfig;... 阅读全文
摘要:
```java public class NamesrvStartup { private static InternalLogger log; private static Properties properties = null; private static CommandLine commandLine = null; public static voi... 阅读全文
摘要:
起因 crontab中的定时任务,执行到关闭tomcat时,报环境变量找不到 解决方案 1.使用 . /etc/profile 引入环境变量 推荐, 实测ubuntu12 成功 2.使用 source /etc/profile 引入环境变量 不推荐,实测ubuntu12 失败 注意 . /etc/p 阅读全文
摘要:
原脚本代码 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 阅读全文
摘要:
起因 这是今天我线上出了一个bug,需要查看日志并统计一个我需要的信息出现的频率,可以叫做分组统计。 日志文件部分内容 目的 统计每个shopId出现的错误的次数 方案 使用awk的分组统计 awk代码 部分统计效果如下 ··· 800599961375 273 800599958609 4 800 阅读全文
摘要:
任务:report.txt文件里有以下内容:记录了一些方法的执行时间,要求按执行时间降序排列. 1 void com.dustpan.zeus.core.service.MergeService.startService(int)|2 2 void com.dustpan.zeus.core.ser 阅读全文