-
1. Re: How to implement TreeCache synchronization?
galder.zamarreno Mar 4, 2013 8:29 AM (in response to kwatsen)Is this question about Infinispan's tree module, or JBoss Cache?
-
2. Re: How to implement TreeCache synchronization?
kwatsen Mar 4, 2013 9:06 AM (in response to galder.zamarreno)Sorry it wasn't clear, this is with Infinispan's tree module.
-
3. Re: How to implement TreeCache synchronization?
kwatsen Mar 7, 2013 1:50 PM (in response to galder.zamarreno)Anyone?
-
4. Re: How to implement TreeCache synchronization?
mircea.markus Mar 8, 2013 10:41 AM (in response to kwatsen)the error is due to the 2nd cluster node thinking that the child is "fully" in the cache when it isn't. For instance, getChildrenNames() will return the the "/foobar" node even if if it only has "key1" (i.e. it hasn't gotten key2 or key3 yet, so the MyObject() constructor gets an error when trying to dereference one of the missing keys. I suppose the constructor could throw an exception and then the could above could step-over the entry, but I was hoping there would be a better way within treecache - and ideas?
I think that's your best option when working with the tree API. If working with lower level API (e.g. the Cache directly) you could use the locking API to prevent concurrent modifications. Actually thiking more about it, another approach would be to have a convention that, when either reading or writing a tree node, to acquire a certain lock (e.g. the FQN).
the error is due to a missing reader-writer lock - the removeNode should block until all readers are out and block new readers from getting in. If it was on the same JVM, I'd use standard synchronization mechanism, but being distributed, what is the best solution?
again the synthetic lock described above should do.