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
DeleteListValue deleteList = DeleteListValue.builder().uid(uid) | |
.hobbies("Drawing").build(); | |
if (daoOperation.deleteNode(deleteList)) { | |
]System.out.println("Update Transaction completed"); | |
]} |
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
//Helper Class for read and write operations for a file. | |
class FileStore { | |
private File storeFolder; | |
// Locks is used so that only one thread can update the file at a | |
// time. | |
private ReadWriteLock lock = new ReentrantReadWriteLock(); |
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
// Example of the executor service | |
class UserRepository implements Closeable { | |
private FileStore fileStore; | |
private ConcurrentHashMap<UUID, User> cache = new ConcurrentHashMap<>(); | |
private ReadWriteLock lock = new ReentrantReadWriteLock(); | |
private ExecutorService executors = Executors.newFixedThreadPool(2); | |
UserRepository(FileStore fnileStore) { | |
this.fileStore = fileStore; |
OlderNewer