Created
July 16, 2022 20:12
-
-
Save ahmedhosnypro/ab698a26a51a2f4c999257e54f254afb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ReadWriteLock lock = new ReentrantReadWriteLock(); | |
// write | |
lock.writeLock().lock(); | |
gson.toJson(data, writer); | |
lock.writeLock().unlock(); | |
// read | |
lock.readLock().lock(); | |
var objectMap = readData(); | |
lock.readLock().unlock(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment