javaapache-zookeeperapache-curator

curator sharedvalue persistency


i was doing some test with sharedValue recipe from Curator framework. I can't find info on how persistence of objects it's kept on zookeeper side.

i am asking that cos i think they are "persistent" out of the box, but after a major restart of all nodes of zookeeper the value seems to be back to empty.

Probably a mistake on code, nothing to be worried about, but i wonder if i am correct assuming that sharedValue object make things "persistent" out of the box, and after creating & updating one with the proper version (i see that other nodes get updated if they register a lsitener) i should be done or i am loosing something


Solution

  • You can see in the source code for SharedValue (https://github.com/apache/curator/blob/master/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java#L256) that the node is created with Curator's default which is persistent. So, I'm not sure what happened in your setup but the node is persistent with this recipe.