James
10/29/2019, 11:08 PMgildor
10/29/2019, 11:10 PMmarstran
10/29/2019, 11:12 PMJames
10/29/2019, 11:13 PMJames
10/29/2019, 11:14 PMoctylFractal
10/29/2019, 11:14 PMMutex
also doesn't seem to support read-write locking (owner token is just for debugging and has no effect on actual mechanics from what I see on the docs)James
10/29/2019, 11:15 PMgildor
10/29/2019, 11:16 PMoctylFractal
10/29/2019, 11:19 PMConcurrentHashMap<Long, Mutex>
should be sufficient for your use case. You can remove from the map when you unlock, so basically one of 2 things happens: 1) no lock in map, resource isn't locked 2) lock in map, try to lock it and either a) acquire lock and process or b) suspend until lock is releasedJames
10/29/2019, 11:19 PMJames
10/29/2019, 11:19 PMoctylFractal
10/29/2019, 11:19 PMoctylFractal
10/29/2019, 11:20 PMJames
10/29/2019, 11:21 PMJames
10/29/2019, 11:22 PMJames
10/29/2019, 11:23 PMJames
10/29/2019, 11:29 PMJames
10/29/2019, 11:38 PMgildor
10/30/2019, 12:28 AMoctylFractal
10/30/2019, 12:29 AMmutex.withLock(action)
James
10/30/2019, 9:53 PM