I'm designing a system from which I will synchronise business data from the mobile device (that have an embedded application) that generates data and sends it back to the server. Each line synchronised generates a specific business log in the database.
If what I synchronise generates data with a date (within the sync data) inferior to the last modification date of my business data, I must ignore it and just add the log in database. Once the uploaded data is processed, data is fetched from the database and downloaded to the device.
Because of this download right after writing, the synchronisation must be synchronous. It's possible still to have a reader/writer pattern if something like this is worth enough to replace my existing solution. The more important thing is to be able to download up-to-date data. That data is fetched as a whole, there is no diff implemented at the moment (it may come later but that won't be a problem).
I may have multiple synchronisations on the same business object running, it's unlikely but can happen and I prefer to be able to handle it. The synchronisation is expected to last for some seconds but not some minutes, unless using the embedded mobile application without resync for some days.
The volume of data synchronised is not expected to be big, neither the synchronisation process.
So I end up using a mutual exclusion on my method of synchronisation, more precisely, I'm using Java and I put a synchronized on the writing method not the whole synchronisation process to not block read-only synchronisation.
I would like to know :
- If this way makes sense? As long the volume and time of synchronization process are still acceptable.
- In a general way, what concepts should I look at. Bonus: if there is any implementation of these concepts in a Spring module.