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

Examples of org.apache.curator.framework.recipes.cache.NodeCache


  public void start() {
    LOGGER.debug("Starting...");
    try {
      client.start();
      try {
        agentNodeCache = new NodeCache(client, basePath + "/" + getAgentName());
        agentNodeCache.start();
        agentNodeCache.getListenable().addListener(new NodeCacheListener() {
          @Override
          public void nodeChanged() throws Exception {
            refreshConfiguration();
View Full Code Here


      final KijiURI tableURI,
      final TableLayoutUpdateHandler handler
  ) {
    mHandler = handler;
    mTableURI = tableURI;
    mCache = new NodeCache(zkClient, ZooKeeperUtils.getTableLayoutFile(mTableURI).getPath());
    mExecutor = Executors.newSingleThreadExecutor(THREAD_FACTORY);
    mCache.getListenable().addListener(new NodeCacheListener() {
      /** {@inheritDoc}. */
      @Override
      public void nodeChanged() throws Exception {
View Full Code Here

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

            final NodeCache cache = new NodeCache(entry.getClient(), path, dataIsCompressed);
            cache.start(buildInitial);

            Closer closer = new Closer()
            {
                @Override
                public void close()
                {
                    try
                    {
                        cache.close();
                    }
                    catch ( IOException e )
                    {
                        log.error("Could not close left-over NodeCache for path: " + path, e);
                    }
                }
            };
            String id = entry.addThing(cache, closer);

            NodeCacheListener listener = new NodeCacheListener()
            {
                @Override
                public void nodeChanged()
                {
                    entry.addEvent(new RpcCuratorEvent(RpcCuratorEventType.NODE_CACHE, path));
                }
            };
            cache.getListenable().addListener(listener);

            return new NodeCacheProjection(id);
        }
        catch ( Exception e )
        {
View Full Code Here

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

            NodeCache nodeCache = CuratorEntry.mustGetThing(entry, cacheProjection.id, NodeCache.class);
            return new RpcChildData(nodeCache.getCurrentData());
        }
        catch ( Exception e )
        {
            throw new RpcException(e);
        }
View Full Code Here

        this.context = context;
        this.curator = curator;
        this.worker = worker;
        this.repository = repository;
        this.workerPath = ZkPath.TASK_MEMBER_PARTITIONS.getPath(name, context.getId());
        this.cache = new NodeCache(curator, workerPath);
    }
View Full Code Here

TOP

Related Classes of org.apache.curator.framework.recipes.cache.NodeCache

Copyright © 2018 www.massapicom. 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.