I am writing a small program that is a client of some protocol. I wanted this program to have a filesystem database. the main directory would contain one directory for a server that is configured, and the server directory would contain things like server settings in json and other data, this time those are certificates, not sure if certificates would be stored in separate dirs.The question is: if it is possible, even though rare, that multiple instances of this app could access the database, and also this program can run in daemon mode multithreaded, what kinds of locks may be needed for thread and for jvm?For example, should I use a read/write lock for inter thread synchronization + a shared or exclusive file lock? should I lock the whole database, or only the directory near the set of files I want to change, like the server directory?
concurrency in hierarchical filesystem databases
java;database