Return-Path: X-Original-To: apmail-curator-user-archive@minotaur.apache.org Delivered-To: apmail-curator-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C9ACB19D59 for ; Thu, 10 Mar 2016 02:04:04 +0000 (UTC) Received: (qmail 88685 invoked by uid 500); 10 Mar 2016 02:04:04 -0000 Delivered-To: apmail-curator-user-archive@curator.apache.org Received: (qmail 88642 invoked by uid 500); 10 Mar 2016 02:04:04 -0000 Mailing-List: contact user-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@curator.apache.org Delivered-To: mailing list user@curator.apache.org Received: (qmail 88627 invoked by uid 99); 10 Mar 2016 02:04:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Mar 2016 02:04:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id EE2C8C3855 for ; Thu, 10 Mar 2016 02:04:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id bHnEqsipVPU6 for ; Thu, 10 Mar 2016 02:04:01 +0000 (UTC) Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id 006D15F1EF for ; Thu, 10 Mar 2016 02:04:00 +0000 (UTC) Received: by mail-wm0-f42.google.com with SMTP id n186so9997628wmn.1 for ; Wed, 09 Mar 2016 18:04:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=heJk5XfxdlJtWEBGXiHQBgJOq59J4RSIp9534y7/26Y=; b=c0y2GYjqIuuQLInc2MPq+Ckq5u9Y8lpWVrw2/jS85OvVGft6Z5vcvtF3zMI2bYN1Q0 k53xn5UEp7CUShZUxHNzQTovrUlMydoULKcn7+1SO2hdaFF0F14qXrSgAYavGXsg62s9 qBPbZe4scPhuQ3sndNXp2b2U6OoR8Qt4WR+iCDJsbmBernxbJeugb/Qd7nJP2qznpcZG TV5m+lW2+KrbRQVRrseP+sGTQ2+pa/mSFwDPGHnMJwGebSEFPcifuluhiiL291ECvqmD 1fPOrtUUl2j+2L+xwuYR3GGokRtB1kkCs57a243BO1Eb9hgg1SYoo1TWj38g/M6CIVfn +vpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=heJk5XfxdlJtWEBGXiHQBgJOq59J4RSIp9534y7/26Y=; b=RNmVVKDVI0DlqaASrvLJWfiAxUlz5VIX1gJMTppDGDQK4t1pixkx/3UITC4ebK2Gys aXDReqLRXjUoPkTSqkn2aHQy8Zn8tK87PULLjFCmbYh95c1qTwcMd0xuAgwQaYtttEHV MF2W7CCSjJOnT+40U8S7D/ZD/hHXH6dolTRg/8wTk4DQS2MayZS/CocFZRDHuIzU7z+S 2K8+LozzyHzcLTJ6oC2T2ltaIw6+mPqvyQpSUnlk/tg3NXUmBHNeEjTrUEg7HZZuw3nV 51nxvzTg1d72H3GMGpqrChKQxWinU5d0/mdZ3Fnqyr/zXEIPOtfKflrTmCIynb9T2Aeh qWOw== X-Gm-Message-State: AD7BkJLMljAxEZBJ2J0ZFCpzAQNXMGVmIyRhfw+C5ZsmHHkJZ+UOGzVXXBfMe7+9lFCkMxMQcDrUR/DgDBNGIg== MIME-Version: 1.0 X-Received: by 10.194.58.234 with SMTP id u10mr763475wjq.174.1457575440679; Wed, 09 Mar 2016 18:04:00 -0800 (PST) Received: by 10.28.213.129 with HTTP; Wed, 9 Mar 2016 18:04:00 -0800 (PST) In-Reply-To: References: <8D219520-B984-48BB-9E66-C55A9D2B3175@jordanzimmerman.com> Date: Wed, 9 Mar 2016 18:04:00 -0800 Message-ID: Subject: Re: curator pathcache From: s influxdb To: user@curator.apache.org Content-Type: multipart/alternative; boundary=047d7ba97db4600e5e052da83aa5 --047d7ba97db4600e5e052da83aa5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable i tried all the curator libraries . still same result . TestingServer or the PathCache isn't working On Wed, Mar 9, 2016 at 5:22 PM, s influxdb wrote: > Ok let me try that. > > On another note this piece of nodecache code works > > final NodeCache nodeCache =3D new NodeCache(client, PATH); > nodeCache.getListenable().addListener(new > NodeCacheListener() { > @Override > public void nodeChanged() throws Exception { > ChildData currentData =3D nodeCache.getCurrentDat= a(); > System.out.println("data change watched, and > current data =3D " + new String(currentData.getData())); > } > }); > nodeCache.start(); > Thread.sleep(50000); > > On Wed, Mar 9, 2016 at 5:20 PM, Cameron McKenzie > wrote: > >> You must have some old Curator stuff on your classpath. All of the >> curator stuff has an org.apache package prefix. It was ported from Netfl= ix >> some time ago. >> >> On Thu, Mar 10, 2016 at 12:15 PM, s influxdb >> wrote: >> >>> I see the TestingServer class in import >>> com.netflix.curator.test.TestingServer; >>> >>> In the sample file i see it as import >>> org.apache.curator.test.TestingServer; >>> >>> Even then i get the below error while instantiating a TestingServer Cla= ss >>> Default constructor cannot handle exception type Exception thrown by >>> implicit super constructor. Must define an explicit constructor >>> >>> Then i tried the TestingCluster class >>> static TestingCluster server =3D new TestingCluster(); >>> >>> That gives me a class not found exception >>> Exception in thread "main" java.lang.NoClassDefFoundError: >>> javassist/NotFoundException >>> at >>> com.netflix.curator.test.TestingCluster.(TestingCluster.java:40= ) >>> >>> >>> On Wed, Mar 9, 2016 at 4:16 PM, Cameron McKenzie >> > wrote: >>> >>>> The TestingServer class is definitely in the curator-test jar, so you >>>> must have some issue with your build / IDE environment. >>>> >>>> On Thu, Mar 10, 2016 at 11:13 AM, s influxdb >>>> wrote: >>>> >>>>> I tried importing the curator-test artifcactid and it this import >>>>> org.apache.curator.test.TestingServer; doesn't resolve >>>>> >>>>> On Wed, Mar 9, 2016 at 2:58 PM, Cameron McKenzie < >>>>> mckenzie.cam@gmail.com> wrote: >>>>> >>>>>> Can you try running the PathCacheExample unmodified? It uses a >>>>>> testing ZK server. But can you just confirm that this much works for= you? >>>>>> Then maybe try and modify the sample so that it connects to your rea= l ZK >>>>>> instance? >>>>>> >>>>>> On Thu, Mar 10, 2016 at 9:53 AM, s influxdb >>>>>> wrote: >>>>>> >>>>>>> i did try adding a sleep and got the same result >>>>>>> cache.start(); >>>>>>> Thread.sleep(5000); >>>>>>> list(cache); >>>>>>> >>>>>>> I am using curator libraries version 2.10 and zookeeper version >>>>>>> 3..4.6 >>>>>>> >>>>>>> On Wed, Mar 9, 2016 at 2:19 PM, Cameron McKenzie < >>>>>>> mckenzie.cam@gmail.com> wrote: >>>>>>> >>>>>>>> I think that you have a race condition between calling start() on >>>>>>>> your cache and calling list(). Calling list() just checks the curr= ent state >>>>>>>> of the cache. If it hasn't communicated with ZK yet, it won't have= any >>>>>>>> data. Try putting in a sleep after the cache.start() call, before = you call >>>>>>>> list(). >>>>>>>> >>>>>>>> On Thu, Mar 10, 2016 at 9:16 AM, s influxdb >>>>>>>> wrote: >>>>>>>> >>>>>>>>> sure >>>>>>>>> >>>>>>>>> main class >>>>>>>>> RetryPolicy retryPolicy =3D new ExponentialBackoffRetry(1000,= 3); >>>>>>>>> client =3D CuratorFrameworkFactory.newClient("10.x.x.= x", >>>>>>>>> retryPolicy); >>>>>>>>> client.start(); >>>>>>>>> SyncData sd =3D new SyncData(client); >>>>>>>>> sd.run(); >>>>>>>>> >>>>>>>>> the class that calls cache >>>>>>>>> >>>>>>>>> private static final String PATH =3D "/zktest"; >>>>>>>>> >>>>>>>>> public void run () throws Exception >>>>>>>>> { >>>>>>>>> try { >>>>>>>>> >>>>>>>>> cache =3D new PathChildrenCache(client, PATH, true); >>>>>>>>> cache.start(); >>>>>>>>> >>>>>>>>> list(cache); >>>>>>>>> >>>>>>>>> >>>>>>>>> for(;;) { >>>>>>>>> try { >>>>>>>>> Thread.sleep(50000); >>>>>>>>> } catch(InterruptedException e) { >>>>>>>>> } >>>>>>>>> } >>>>>>>>> >>>>>>>>> } >>>>>>>>> finally { >>>>>>>>> CloseableUtils.closeQuietly(cache); >>>>>>>>> } >>>>>>>>> } >>>>>>>>> >>>>>>>>> On Wed, Mar 9, 2016 at 1:30 PM, Cameron McKenzie < >>>>>>>>> mckenzie.cam@gmail.com> wrote: >>>>>>>>> >>>>>>>>>> I just tried running the example and it seems to work fine for >>>>>>>>>> me. I assume that you modified the code in some way for it to ru= n against a >>>>>>>>>> proper ZK instance? Can you post it somewhere? >>>>>>>>>> >>>>>>>>>> On Thu, Mar 10, 2016 at 5:53 AM, s influxdb < >>>>>>>>>> elastic.l.k@gmail.com> wrote: >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> ---------- Forwarded message ---------- >>>>>>>>>>> From: s influxdb >>>>>>>>>>> Date: Wed, Mar 9, 2016 at 10:36 AM >>>>>>>>>>> Subject: Re: curator pathcache >>>>>>>>>>> To: Jordan Zimmerman >>>>>>>>>>> Cc: user@curator.apache.org >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Sorry for posting this in a wrong forum the first time. >>>>>>>>>>> >>>>>>>>>>> I recreated a new project and was running the example code here >>>>>>>>>>> for cache : >>>>>>>>>>> http://curator.apache.org/curator-examples/index.html >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Today when i try to replicathe NPE i am unable to do that . >>>>>>>>>>> However when i call the list(cache) it prints the size of the >>>>>>>>>>> data in the node as 0. This works with NodeCache >>>>>>>>>>> >>>>>>>>>>> Curator libraries are 2.10 and zookeeper version 3.4.6. >>>>>>>>>>> >>>>>>>>>>> Ideally i would like to use TreeCache but it gave me NPE too. M= y >>>>>>>>>>> use case is setting a watch on the entire znode in the cluster = and be >>>>>>>>>>> notified about it. Thanks for replying to the mail. >>>>>>>>>>> >>>>>>>>>>> private static void list(PathChildrenCache cache) >>>>>>>>>>> { >>>>>>>>>>> if ( cache.getCurrentData().size() =3D=3D 0 ) >>>>>>>>>>> { >>>>>>>>>>> System.out.println("* empty *"); >>>>>>>>>>> } >>>>>>>>>>> else >>>>>>>>>>> { >>>>>>>>>>> for ( ChildData data : cache.getCurrentData() ) >>>>>>>>>>> { >>>>>>>>>>> System.out.println(data.getPath() + " =3D " + n= ew >>>>>>>>>>> String(data.getData())); >>>>>>>>>>> } >>>>>>>>>>> } >>>>>>>>>>> } >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On Wed, Mar 9, 2016 at 9:44 AM, Jordan Zimmerman < >>>>>>>>>>> jordan@jordanzimmerman.com> wrote: >>>>>>>>>>> >>>>>>>>>>>> Moving this to Curator=E2=80=99s list=E2=80=A6 >>>>>>>>>>>> >>>>>>>>>>>> Where do you get the NPE? Please send the stacktrace. >>>>>>>>>>>> >>>>>>>>>>>> -Jordan >>>>>>>>>>>> >>>>>>>>>>>> > On Mar 8, 2016, at 8:27 PM, s influxdb >>>>>>>>>>>> wrote: >>>>>>>>>>>> > >>>>>>>>>>>> > I am trying to run the path cahce and keep java NPE >>>>>>>>>>>> > >>>>>>>>>>>> > Running curator 2.9.0 libraries against a zookeeper 3.4.6 >>>>>>>>>>>> cluster >>>>>>>>>>>> > Even >>>>>>>>>>>> > >>>>>>>>>>>> > The samples are taken from the curator examples . >>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>>> > public void run () throws Exception >>>>>>>>>>>> > { >>>>>>>>>>>> > try { >>>>>>>>>>>> > >>>>>>>>>>>> > pcache =3D new PathChildrenCache(client, PATH= , >>>>>>>>>>>> true); >>>>>>>>>>>> > pcache.start(); >>>>>>>>>>>> > >>>>>>>>>>>> > addListener(cache); >>>>>>>>>>>> > >>>>>>>>>>>> > // list(pcache); >>>>>>>>>>>> > >>>>>>>>>>>> > pcache.close(); >>>>>>>>>>>> > } >>>>>>>>>>>> > finally { >>>>>>>>>>>> > CloseableUtils.closeQuietly(cache); >>>>>>>>>>>> > } >>>>>>>>>>>> > } >>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>>> > private static void addListener(PathChildrenCache cache= ) >>>>>>>>>>>> > { >>>>>>>>>>>> > // a PathChildrenCacheListener is optional. Here, >>>>>>>>>>>> it's used just >>>>>>>>>>>> > to log changes >>>>>>>>>>>> > PathChildrenCacheListener listener =3D new >>>>>>>>>>>> > PathChildrenCacheListener() >>>>>>>>>>>> > { >>>>>>>>>>>> > @Override >>>>>>>>>>>> > public void childEvent(CuratorFramework client, >>>>>>>>>>>> > PathChildrenCacheEvent event) throws Exception >>>>>>>>>>>> > { >>>>>>>>>>>> > switch ( event.getType() ) >>>>>>>>>>>> > { >>>>>>>>>>>> > case CHILD_ADDED: >>>>>>>>>>>> > { >>>>>>>>>>>> > System.out.println("Node added: " + >>>>>>>>>>>> > ZKPaths.getNodeFromPath(event.getData().getPath())); >>>>>>>>>>>> > break; >>>>>>>>>>>> > } >>>>>>>>>>>> > >>>>>>>>>>>> > case CHILD_UPDATED: >>>>>>>>>>>> > { >>>>>>>>>>>> > System.out.println("Node changed: "= + >>>>>>>>>>>> > ZKPaths.getNodeFromPath(event.getData().getPath())); >>>>>>>>>>>> > break; >>>>>>>>>>>> > } >>>>>>>>>>>> > >>>>>>>>>>>> > case CHILD_REMOVED: >>>>>>>>>>>> > { >>>>>>>>>>>> > System.out.println("Node removed: "= + >>>>>>>>>>>> > ZKPaths.getNodeFromPath(event.getData().getPath())); >>>>>>>>>>>> > break; >>>>>>>>>>>> > } >>>>>>>>>>>> > } >>>>>>>>>>>> > } >>>>>>>>>>>> > }; >>>>>>>>>>>> > cache.getListenable().addListener(listener); >>>>>>>>>>>> > } >>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>>> > Here running a list returns empty size all the time >>>>>>>>>>>> > >>>>>>>>>>>> > private static void list(PathChildrenCache cache) >>>>>>>>>>>> > { >>>>>>>>>>>> > >>>>>>>>>>>> > if ( cache.getCurrentData().size() =3D=3D 0 ) >>>>>>>>>>>> > { >>>>>>>>>>>> > System.out.println("* empty *"); >>>>>>>>>>>> > } >>>>>>>>>>>> > else >>>>>>>>>>>> > { >>>>>>>>>>>> > for ( ChildData data : cache.getCurrentData()= ) >>>>>>>>>>>> > { >>>>>>>>>>>> > System.out.println(data.getPath() + " =3D= " >>>>>>>>>>>> + new >>>>>>>>>>>> > String(data.getData())); >>>>>>>>>>>> > } >>>>>>>>>>>> > } >>>>>>>>>>>> > } >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> > --047d7ba97db4600e5e052da83aa5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
i tried all the curator libraries . still same result . Te= stingServer or the PathCache isn't working

On Wed, Mar 9, 2016 at 5:22 PM, s in= fluxdb <elastic.l.k@gmail.com> wrote:
Ok let me try that.

On = another note this piece of nodecache code works

=C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 final NodeCache nodeCa= che =3D new NodeCache(client, PATH);
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 nodeCache.getListenable().ad= dListener(new NodeCacheListener() {
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 @Ove= rride
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 public void nodeChanged() throws Ex= ception {
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ChildDat= a currentData =3D nodeCache.getCurrentData();
=C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 System.out.println("data change watched= , and current data =3D " + new String(currentData.getData()));
=C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 }
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 });
=C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 nodeCache.start();
= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 Thread.sleep(50000);

On = Wed, Mar 9, 2016 at 5:20 PM, Cameron McKenzie <mckenzie.cam@gmail.com= > wrote:
Y= ou must have some old Curator stuff on your classpath. All of the curator s= tuff has an org.apache package prefix. It was ported from Netflix some time= ago.

On Thu, Mar 10, 2016 at 12:15 PM, s influxdb <elastic.l.k@gmail.co= m> wrote:
=
I see the TestingServer class in=C2=A0 import com.netflix.curator= .test.TestingServer;

In the sample file i see it as import org= .apache.curator.test.TestingServer;

Even then i get the below = error while instantiating a TestingServer Class
Default constr= uctor cannot handle exception type Exception thrown by implicit super const= ructor. Must define an explicit constructor

Then i tried = the TestingCluster class
static TestingCluster=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 server =3D new TestingCluster();

That gives = me a class not found exception
Exception in thread "main" java= .lang.NoClassDefFoundError: javassist/NotFoundException
=C2=A0=C2=A0=C2= =A0 at com.netflix.curator.test.TestingCluster.<clinit>(TestingCluste= r.java:40)


On Wed, Mar 9, 2016 at 4:16 PM, Cam= eron McKenzie <mckenzie.cam@gmail.com> wrote:
The TestingServer class is defini= tely in the curator-test jar, so you must have some issue with your build /= IDE environment.

On Thu, Mar 10, 2016 at 11:13 AM, s influxdb <elastic= .l.k@gmail.com> wrote:
I tried importing the curator-test artifcactid and it this imp= ort org.apache.curator.test.TestingServer; doesn't resolve

On Wed, Ma= r 9, 2016 at 2:58 PM, Cameron McKenzie <mckenzie.cam@gmail.com>= ; wrote:
Can you = try running the PathCacheExample unmodified? It uses a testing ZK server. B= ut can you just confirm that this much works for you? Then maybe try and mo= dify the sample so that it connects to your real ZK instance?

On Thu, Mar 10,= 2016 at 9:53 AM, s influxdb <elastic.l.k@gmail.com> wro= te:
i did try addin= g a sleep and got the same result
=C2=A0=C2=A0=C2=A0=C2=A0 cache.start()= ;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Thr= ead.sleep(5000);
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 list(cache);

I am using curator libraries version= 2.10 and zookeeper version 3..4.6

On Wed, Mar 9, 2016 at 2:19 PM, Camero= n McKenzie <mckenzie.cam@gmail.com> wrote:
I think that you have a race conditi= on between calling start() on your cache and calling list(). Calling list()= just checks the current state of the cache. If it hasn't communicated = with ZK yet, it won't have any data. Try putting in a sleep after the c= ache.start() call, before you call list().

On Thu, Mar 10, 2016 at 9:16 AM, s= influxdb <elastic.l.k@gmail.com> wrote:
sure

main class=
=C2=A0=C2=A0=C2=A0 RetryPolicy retryPolicy =3D new ExponentialBackoffRe= try(1000, 3);
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 c= lient =3D CuratorFrameworkFactory.newClient("10.x.x.x", retryPoli= cy);
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 client.sta= rt();
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 SyncData = sd =3D new SyncData(client);
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 sd.run();
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0
the class that calls cache

private static fin= al String PATH =3D "/zktest";

=C2=A0=C2=A0=C2=A0 pub= lic void run () throws Exception
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 {
= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 try {
=C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cache =3D new PathChild= renCache(client, PATH, true);
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cache.start();

=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 list(cache);
=C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for(;;) {
=C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 try {
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 Thread.sleep(50000);
=C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 } catch(InterruptedException e) {
=C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 }
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 }
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 }
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= finally {
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 CloseableUtils.closeQuietly(cache);
=C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 }
=C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 }

On Wed, Mar 9, 2016 at 1:30 PM, Cameron McKenzie <mckenzie.cam@gmail.com> wrote:
I just tried running the example and it seems to w= ork fine for me. I assume that you modified the code in some way for it to = run against a proper ZK instance? Can you post it somewhere?

On Thu, Mar 10, = 2016 at 5:53 AM, s influxdb <elastic.l.k@gmail.com> wrot= e:

---------- Forwarded message ----------
From: s influxdb <elastic.l.k@gmail.com>
= Date: Wed, Mar 9, 2016 at 10:36 AM
Subject: Re: curator pathcache
To:= Jordan Zimmerman <jordan@jordanzimmerman.com>
Cc: user@curator.apache.org

=
Sorry for posting this in a wrong = forum the first time.

I recreated a new project and was runnin= g the example code here for cache : http://curator.apache.org/cura= tor-examples/index.html


Today when i=C2=A0 try to repl= icathe NPE i am unable to do that .
However when i call the=C2=A0 list(= cache) it prints the size of the data in the node as 0. This works with Nod= eCache

Curator libraries are 2.10 and zookeeper version 3.4.6.=

Ideally i would like to use TreeCache but it gave me NPE too.= My use case is setting a watch on the entire znode in the cluster and be n= otified about it. Thanks for replying to the mail.

=C2=A0=C2=A0=C2=A0 private static void list(PathChildrenCache cac= he)
=C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 i= f ( cache.getCurrentData().size() =3D=3D 0 )
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 System.out.println("* empty *");
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 }
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= else
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for ( ChildData data : cac= he.getCurrentData() )
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 System.out.println(data.getPath() += " =3D " + new String(data.getData()));
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 }
=C2=A0=C2=A0=C2=A0 }
=C2=A0=C2=A0=C2=A0 =C2=A0 <= br>


=

On Wed, Mar = 9, 2016 at 9:44 AM, Jordan Zimmerman <jordan@jordanzimmerman.com<= /a>> wrote:
Moving this to Cura= tor=E2=80=99s list=E2=80=A6

Where do you get the NPE? Please send the stacktrace.

-Jordan

> On Mar 8, 2016, at 8:27 PM, s influxdb <
elastic.l.k@gmail.com> wrote:
>
> I am trying to run the path cahce and keep java NPE
>
> Running curator 2.9.0 libraries against a zookeeper 3.4.6 cluster
> Even
>
> The samples are taken from the curator examples .
>
>
>
>=C2=A0 public void run () throws Exception
>=C2=A0 =C2=A0 =C2=A0 =C2=A0{
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0try {
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pcache =3D new = PathChildrenCache(client, PATH, true);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pcache.start();
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 addListener(cac= he);
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0//=C2=A0 =C2=A0 list(pcache);<= br> >
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pcache.close();<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0finally {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 CloseableUtils.= closeQuietly(cache);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
>
>
>=C2=A0 =C2=A0 =C2=A0 private static void addListener(PathChildrenCache = cache)
>=C2=A0 =C2=A0 =C2=A0 {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // a PathChildrenCacheListener is op= tional. Here, it's used just
> to log changes
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PathChildrenCacheListener listener = =3D new
> PathChildrenCacheListener()
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 @Override
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 public void childEvent= (CuratorFramework client,
> PathChildrenCacheEvent event) throws Exception
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 switch (= event.getType() )
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 case CHILD_ADDED:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 System.out.println("Node added: " +
> ZKPaths.getNodeFromPath(event.getData().getPath()));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 break;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 }
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 case CHILD_UPDATED:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 System.out.println("Node changed: " +
> ZKPaths.getNodeFromPath(event.getData().getPath()));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 break;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 }
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 case CHILD_REMOVED:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 System.out.println("Node removed: " +
> ZKPaths.getNodeFromPath(event.getData().getPath()));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 break;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 }
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 };
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cache.getListenable().addListener(li= stener);
>=C2=A0 =C2=A0 =C2=A0 }
>
>
> Here running a list returns empty size all the time
>
>=C2=A0 =C2=A0 =C2=A0 private static void list(PathChildrenCache cache)<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 {
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ( cache.getCurrentData().s= ize() =3D=3D 0 )
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 System.out.prin= tln("* empty *");
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for ( ChildData= data : cache.getCurrentData() )
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 S= ystem.out.println(data.getPath() + " =3D " + new
> String(data.getData()));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 }














--047d7ba97db4600e5e052da83aa5--