I have the use case to update epoch time of events in a long variable. This variable will have lots of concurrent reads and writes as well. Here are the requirements in detail:
Which of the alternatives is a better option for my use case:
(x,y) -> y
使用AtomicLong
因为它有助于避免显式锁定的额外开销
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.