codingapi / codingapi/tx-lcn

LockContext map Concurrent Question

Open
#553 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
4.2k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

- [ ] I have searched the [issues](https://github.com/codingapi/tx-lcn/issues) of this repository and believe that this is not a duplicate.

### 1. Bug Description
LockContext
private Map map;
private LockContext() {
map = new ConcurrentHashMap<>();

cacheList = new CopyOnWriteArrayList<>();

freeList = new LinkedList<>();
}

map is ConcurrentHashMap 但是你在操作这个元素时 加锁防止脏读,污写 ,完全没必要了

### 4. Tour Idea
既然是ConcurrentHashMap 完全可以把synchronized 锁去掉,而且不会脏读,重复添加, 这样做牺牲性能了

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.