Adding a TODO item around invaliding caching, as Zookeeper is capable of doing that across clients, and perhaps other systems have or will have that as well.
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/dcea137d Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/dcea137d Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/dcea137d Branch: refs/heads/develop Commit: dcea137d1ec5901db2918c4f47c643587019eda0 Parents: 68b55fa Author: niclas <[email protected]> Authored: Thu Apr 26 09:04:01 2018 +0800 Committer: niclas <[email protected]> Committed: Thu Apr 26 09:04:01 2018 +0800 ---------------------------------------------------------------------- .../entitystore/zookeeper/ZookeeperEntityStoreMixin.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/dcea137d/extensions/entitystore-zookeeper/src/main/java/org/apache/polygene/entitystore/zookeeper/ZookeeperEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-zookeeper/src/main/java/org/apache/polygene/entitystore/zookeeper/ZookeeperEntityStoreMixin.java b/extensions/entitystore-zookeeper/src/main/java/org/apache/polygene/entitystore/zookeeper/ZookeeperEntityStoreMixin.java index 59a0b5a..fb97301 100644 --- a/extensions/entitystore-zookeeper/src/main/java/org/apache/polygene/entitystore/zookeeper/ZookeeperEntityStoreMixin.java +++ b/extensions/entitystore-zookeeper/src/main/java/org/apache/polygene/entitystore/zookeeper/ZookeeperEntityStoreMixin.java @@ -94,7 +94,7 @@ public class ZookeeperEntityStoreMixin int sessionTimeout = config.sessionTimeout().get(); - zkClient = new ZooKeeper( hostPort, sessionTimeout, watcher == null ? new DummyWatcher() : watcher ); + zkClient = new ZooKeeper( hostPort, sessionTimeout, watcher == null ? new EntityStoreWatcher() : watcher ); createStorageNodeIfNotExists( config ); } @@ -324,9 +324,16 @@ public class ZookeeperEntityStoreMixin } } - private class DummyWatcher + private class EntityStoreWatcher implements Watcher { + // TODO: Invalidate cache? + // I (niclas) think that the only events that arrive here are create, delete, data changed and children changed + // So, the question is; Should we try to invalidate the cache (if present) for these changes? If so; How is that done? + // + // Additionally, that might raise the question of having cache invalidation interface in the EntityStore SPI, and + // by extension into the MapEntityStore SPI. + @Override public void process( WatchedEvent event ) {
