Package org.apache.curator.framework.recipes.cache

Examples of org.apache.curator.framework.recipes.cache.PathChildrenCache.start()


            client = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(1000, 3));
            client.start();

            // in this example we will cache data. Notice that this is optional.
            cache = new PathChildrenCache(client, PATH, true);
            cache.start();

            processCommands(client, cache);
        }
        finally
        {
View Full Code Here


            client = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(1000, 3));
            client.start();

            // in this example we will cache data. Notice that this is optional.
            cache = new PathChildrenCache(client, PATH, true);
            cache.start();

            processCommands(client, cache);
        }
        finally
        {
View Full Code Here

              inventoryCache.getListenable().addListener(new InventoryCacheListener(containerKey, inventoryPath));

              containers.put(containerKey, new ContainerHolder(container, inventoryCache));

              log.info("Starting inventory cache for %s, inventoryPath %s", containerKey, inventoryPath);
              inventoryCache.start(PathChildrenCache.StartMode.POST_INITIALIZED_EVENT);
              strategy.newContainer(container);
            }

            break;
          }
View Full Code Here

            client = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(1000, 3));
            client.start();

            // in this example we will cache data. Notice that this is optional.
            cache = new PathChildrenCache(client, PATH, true);
            cache.start();

            processCommands(client, cache);
        }
        finally
        {
View Full Code Here

        try
        {
            final CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);

            final PathChildrenCache cache = new PathChildrenCache(entry.getClient(), path, cacheData, dataIsCompressed, ThreadUtils.newThreadFactory("PathChildrenCacheResource"));
            cache.start(PathChildrenCache.StartMode.valueOf(startMode.name()));

            Closer closer = new Closer()
            {
                @Override
                public void close()
View Full Code Here

    }

    public List<String> listenToGroup(String parentPath, PathChildrenCacheListener listener, boolean cacheData) throws Exception {
        PathChildrenCache cache = new PathChildrenCache(zkClient, parentPath, cacheData);
        cache.getListenable().addListener(listener);
        cache.start();
        return zkClient.getChildren().forPath(parentPath);
    }
}
View Full Code Here

            }
          });
          try {
            Paths.ensurePath(client, Paths.CONTAINERS);
            cacheRef.set(cache);
            cache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
          }
          catch (Exception e) {
            try {
              cache.close();
            }
View Full Code Here

    PathChildrenCache cache = mapChildren.get(path);
    if (cache == null) {
      mapChildren.put(path, cache = new PathChildrenCache(zooKeeperConnection.getClient(), path, true));
      try {
        cache.getListenable().addListener(listener);
        cache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
      }
      catch (Exception e) {
        throw ZooKeeperUtils.wrapThrowable(e);
      }
    }
View Full Code Here

        String requestedModulesPath = Paths.build(Paths.MODULE_DEPLOYMENTS, Paths.REQUESTED);
        Paths.ensurePath(client, requestedModulesPath);
        String allocatedModulesPath = Paths.build(Paths.MODULE_DEPLOYMENTS, Paths.ALLOCATED);
        Paths.ensurePath(client, allocatedModulesPath);
        moduleDeploymentRequests = instantiatePathChildrenCache(client, requestedModulesPath);
        moduleDeploymentRequests.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);

        streamDeploymentListener = new StreamDeploymentListener(zkConnection,
            moduleDeploymentRequests,
            containerRepository,
            streamFactory,
View Full Code Here

    zkConnection.start();
    CuratorFramework client = zkConnection.getClient();
    PathChildrenCache cache = new PathChildrenCache(client, Paths.build(Paths.STREAMS), true);
    cache.getListenable().addListener(new ListenerOne());
    cache.getListenable().addListener(new ListenerTwo());
    cache.start();

    Paths.ensurePath(client, Paths.STREAMS);

    for (int i = 0; i < 100; i++) {
      client.create().creatingParentsIfNeeded().forPath(
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.