应用场景 举个栗子,30个人上一个公共厕所,但是只有3个坑位 semaphore.acquire sync acquireSharedInterruptibly ①AQS setHeadAndPropagate sync .releaseShared ① AQS tryReleaseShared,具 ...
分类:
其他好文 时间:
2020-04-18 12:12:17
阅读次数:
68
秒杀大家都不陌生。自2011年首次出现以来,无论是双十一购物还是 12306 抢票,秒杀场景已随处可见。简单来说,秒杀就是在同一时刻大量请求争抢购买同一商品并完成交易的过程。 从架构视角来看,秒杀系统本质是一个高性能、高一致、高可用的三高系统。而打造并维护一个超大流量的秒杀系统需要进行哪些关注,就是 ...
分类:
其他好文 时间:
2020-04-18 09:48:00
阅读次数:
92
如何填满一个HashMap? step_1 : 计算所需内存 在64位JVM情况下,对象markword占8个字节,指向类的指针占8个字节。 HashMap的每一个节点结构如下: 综上所述,每一个 在默认8字节对齐后占48字节。 HashMap规定最多含有2G个 2G 48=96G 按照该数组的最大 ...
分类:
其他好文 时间:
2020-04-16 19:28:50
阅读次数:
53
PuTTY Trick 1: Delete All PuTTY Sessions Together When you are swapping an old computer with a new computer, you may end-up transferring all PuTTY ses ...
分类:
其他好文 时间:
2020-04-16 01:01:51
阅读次数:
291
迁移postgres数据库的时候,有时候会出现序列与数据库值不匹配的现象.参考了https://stackoverflow.com/questions/244243/how-to-reset-postgres-primary-key-sequence-when-it-falls-out-of-syn ...
分类:
其他好文 时间:
2020-04-15 01:00:23
阅读次数:
91
with t as ( select '-' as col1 --isnumeric('-')这里会判断为数字,所以不能用 union all select '1' as col1 union all select '2' as col1 union all select '3.4' as col1 ...
分类:
其他好文 时间:
2020-04-14 22:16:53
阅读次数:
61
题目 An army of ants walk on a horizontal pole of length l cm, each with a constant speed of 1 cm/s. When a walking ant reaches an end of the pole, it i ...
分类:
其他好文 时间:
2020-04-14 15:20:24
阅读次数:
89
The headers or library files could not be found for jpeg, a required dependency when compiling Pillow from source. Please see the install instructions ...
分类:
其他好文 时间:
2020-04-14 12:45:40
阅读次数:
224
题目 An army of ants walk on a horizontal pole of length l cm, each with a constant speed of 1 cm/s. When a walking ant reaches an end of the pole, it i ...
分类:
其他好文 时间:
2020-04-14 12:25:13
阅读次数:
52
这篇文章在借鉴前人的基础上,进行了验证,感谢前人的分享 一、case when的使用方法 Case具有两种格式。简单Case函数和Case搜索函数。 第一种 格式 : 简单Case函数 : 格式说明 case 列名 when 条件值1 then 选项1 when 条件值2 then 选项2..... ...
分类:
其他好文 时间:
2020-04-14 10:47:54
阅读次数:
70