Should I wrap my curator (zookeeper library) calls within synchronized function in Java or will it be an overkill

StackOverflow https://stackoverflow.com/questions/23283481

Domanda

I am using curator library for zookeeper for interprocess lock across machines. There is just one function in which I create the lock, perform the work and then release the lock. Should I use synchronized keyword with this function to ensure that the threads on the same machine call this function serially and hence minimize calls to zookeeper or does it seem to be an overkill?

È stato utile?

Soluzione

Curator methods are all re-entrant and thread safe (unless specifically noted). So, no you don't need additional synchronization.

NOTE: I'm the main author of Curator.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top