cn.jojo.edu.jetcache.support.DefaultCacheMonitor#afterOperation 并发问题
- Dominant language
- Java
- Stars
- 5.6k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
"DubboServerHandler-172.20.6.168:20880-thread-294" Id=543 BLOCKED on com.alicp.jetcache.support.DefaultCacheMonitor@71945b4e owned by "DubboServerHandler-172.20.6.168:20880-thread-179" Id=414
at com.alicp.jetcache.support.DefaultCacheMonitor.afterOperation(DefaultCacheMonitor.java:61)
- blocked on com.alicp.jetcache.support.DefaultCacheMonitor@71945b4e
- 问题:在并发场景下会出现一定程度的阻塞(blocked)
- 方法:com.alicp.jetcache.support.DefaultCacheMonitor#afterOperation
- 疑问:想问一下,如果把该方法上的 synchronized 去掉,然后进行优化,是否可以避免阻塞问题
- 改进:
1. 将 synchronized 加在对应的业务方法上
2. 内部的统计采用 LongAdder 或者 AtomicLong 来处理
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with com.alicp.jetcache.support.DefaultCacheMonitor#afterOperation in DefaultCacheMonitor.java at the reported line 61, then trace the concurrent statistics updated there. Reproduce the blocked-thread behavior under concurrent operations and evaluate the proposed synchronization, LongAdder, or AtomicLong changes. Done means the concurrency behavior is verified and the chosen change avoids unnecessary blocking without breaking statistics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100