public PersistentPathChildrenCache(final CuratorFramework curator, final String path, final String clusterId, final Path snapshotFile, final JavaType valueType) throws IOException, InterruptedException { this.curator = curator; this.path = path; this.clusterId = clusterId; this.valueType = valueType; final MapType mapType = Json.typeFactory().constructMapType(HashMap.class, Json.type(String.class), valueType); final Supplier<Map<String, T>> empty = Suppliers.ofInstance(Collections.<String, T>emptyMap()); this.snapshot = PersistentAtomicReference.create(snapshotFile, mapType, empty); this.reactor = new DefaultReactor("zk-ppcc:" + path, new Update(), REFRESH_INTERVAL_MILLIS); curator.getConnectionStateListenable().addListener(new ConnectionListener()); }
public PersistentPathChildrenCache(final CuratorFramework curator, final String path, final String clusterId, final Path snapshotFile, final JavaType valueType) throws IOException, InterruptedException { this.curator = curator; this.path = path; this.clusterId = clusterId; this.valueType = valueType; final MapType mapType = Json.typeFactory().constructMapType(HashMap.class, Json.type(String.class), valueType); final Supplier<Map<String, T>> empty = Suppliers.ofInstance(Collections.<String, T>emptyMap()); this.snapshot = PersistentAtomicReference.create(snapshotFile, mapType, empty); this.reactor = new DefaultReactor("zk-ppcc:" + path, new Update(), REFRESH_INTERVAL_MILLIS); curator.getConnectionStateListenable().addListener(new ConnectionListener()); }