Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private volatile Map<...> db = new HashMap<>();
- ...
- void synchronized update() {
- var tmpDb = new HashMap<>();
- // populate tmpDb then swap
- db = tmpDb;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement