You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@curator.apache.org by Sunil Abraham <s....@gmail.com> on 2014/10/23 00:23:44 UTC

Only getting PathChildrenCache updated after calling rebuild

Hi everyone,

I am having difficulty with the the PathChildrenCache; specifically,
the local cache, which I am accessing through the getCurrentData
method, seems to only to get updated after I call the rebuild method.

Does anyone have any thoughts?

S

Re: Only getting PathChildrenCache updated after calling rebuild

Posted by Sunil Abraham <s....@gmail.com>.
Brilliant. Just to confirm for future users:

adding

Thread.sleep(500)

before each "Pre" fixes it.

Bests, S

On Thu, Oct 23, 2014 at 8:44 AM, Jordan Zimmerman
<jo...@jordanzimmerman.com> wrote:
> Updates occur in a different thread. Add a small sleep before
> cache.getCurrentData() and the test works as expected.
>
> -JZ
>
>
> On October 22, 2014 at 11:17:10 PM, Sunil Abraham (s.abraham@gmail.com)
> wrote:
>
> Sorry, was creating a minimal test case and not everything got copied
> over. Here's a better example
>
> https://gist.github.com/sabraham/f987395ff33fdbc8debc
>
> Stdout:
>
> foo
> Pre: 0
> Post: 1
> Pre: 1
> Post: 2
>
> Whereas I would have expected Pre to match Post.
>
> On Wed, Oct 22, 2014 at 7:17 PM, Jordan Zimmerman
> <jo...@jordanzimmerman.com> wrote:
>> You’re not starting the cache. You need to call cache.start()
>>
>>
>> On October 22, 2014 at 6:12:23 PM, Sunil Abraham (s.abraham@gmail.com)
>> wrote:
>>
>> Yup, here's a gist:
>>
>> https://gist.github.com/anonymous/1f7fdab9777e02d91ac1
>>
>> On Wed, Oct 22, 2014 at 6:27 PM, Jordan Zimmerman
>> <jo...@jordanzimmerman.com> wrote:
>>> Can you provide a test that shows the problem?
>>>
>>> -JZ
>>>
>>>
>>> On October 22, 2014 at 5:24:06 PM, Sunil Abraham (s.abraham@gmail.com)
>>> wrote:
>>>
>>> Hi everyone,
>>>
>>> I am having difficulty with the the PathChildrenCache; specifically,
>>> the local cache, which I am accessing through the getCurrentData
>>> method, seems to only to get updated after I call the rebuild method.
>>>
>>> Does anyone have any thoughts?
>>>
>>> S

Re: Only getting PathChildrenCache updated after calling rebuild

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
Updates occur in a different thread. Add a small sleep before cache.getCurrentData() and the test works as expected.

-JZ


On October 22, 2014 at 11:17:10 PM, Sunil Abraham (s.abraham@gmail.com) wrote:

Sorry, was creating a minimal test case and not everything got copied  
over. Here's a better example  

https://gist.github.com/sabraham/f987395ff33fdbc8debc  

Stdout:  

foo  
Pre: 0  
Post: 1  
Pre: 1  
Post: 2  

Whereas I would have expected Pre to match Post.  

On Wed, Oct 22, 2014 at 7:17 PM, Jordan Zimmerman  
<jo...@jordanzimmerman.com> wrote:  
> You’re not starting the cache. You need to call cache.start()  
>  
>  
> On October 22, 2014 at 6:12:23 PM, Sunil Abraham (s.abraham@gmail.com)  
> wrote:  
>  
> Yup, here's a gist:  
>  
> https://gist.github.com/anonymous/1f7fdab9777e02d91ac1  
>  
> On Wed, Oct 22, 2014 at 6:27 PM, Jordan Zimmerman  
> <jo...@jordanzimmerman.com> wrote:  
>> Can you provide a test that shows the problem?  
>>  
>> -JZ  
>>  
>>  
>> On October 22, 2014 at 5:24:06 PM, Sunil Abraham (s.abraham@gmail.com)  
>> wrote:  
>>  
>> Hi everyone,  
>>  
>> I am having difficulty with the the PathChildrenCache; specifically,  
>> the local cache, which I am accessing through the getCurrentData  
>> method, seems to only to get updated after I call the rebuild method.  
>>  
>> Does anyone have any thoughts?  
>>  
>> S  

Re: Only getting PathChildrenCache updated after calling rebuild

Posted by Sunil Abraham <s....@gmail.com>.
Sorry, was creating a minimal test case and not everything got copied
over. Here's a better example

https://gist.github.com/sabraham/f987395ff33fdbc8debc

Stdout:

foo
Pre: 0
Post: 1
Pre: 1
Post: 2

Whereas I would have expected Pre to match Post.

On Wed, Oct 22, 2014 at 7:17 PM, Jordan Zimmerman
<jo...@jordanzimmerman.com> wrote:
> You’re not starting the cache. You need to call cache.start()
>
>
> On October 22, 2014 at 6:12:23 PM, Sunil Abraham (s.abraham@gmail.com)
> wrote:
>
> Yup, here's a gist:
>
> https://gist.github.com/anonymous/1f7fdab9777e02d91ac1
>
> On Wed, Oct 22, 2014 at 6:27 PM, Jordan Zimmerman
> <jo...@jordanzimmerman.com> wrote:
>> Can you provide a test that shows the problem?
>>
>> -JZ
>>
>>
>> On October 22, 2014 at 5:24:06 PM, Sunil Abraham (s.abraham@gmail.com)
>> wrote:
>>
>> Hi everyone,
>>
>> I am having difficulty with the the PathChildrenCache; specifically,
>> the local cache, which I am accessing through the getCurrentData
>> method, seems to only to get updated after I call the rebuild method.
>>
>> Does anyone have any thoughts?
>>
>> S

Re: Only getting PathChildrenCache updated after calling rebuild

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
You’re not starting the cache. You need to call cache.start()


On October 22, 2014 at 6:12:23 PM, Sunil Abraham (s.abraham@gmail.com) wrote:

Yup, here's a gist:  

https://gist.github.com/anonymous/1f7fdab9777e02d91ac1  

On Wed, Oct 22, 2014 at 6:27 PM, Jordan Zimmerman  
<jo...@jordanzimmerman.com> wrote:  
> Can you provide a test that shows the problem?  
>  
> -JZ  
>  
>  
> On October 22, 2014 at 5:24:06 PM, Sunil Abraham (s.abraham@gmail.com)  
> wrote:  
>  
> Hi everyone,  
>  
> I am having difficulty with the the PathChildrenCache; specifically,  
> the local cache, which I am accessing through the getCurrentData  
> method, seems to only to get updated after I call the rebuild method.  
>  
> Does anyone have any thoughts?  
>  
> S  

Re: Only getting PathChildrenCache updated after calling rebuild

Posted by Sunil Abraham <s....@gmail.com>.
Yup, here's a gist:

https://gist.github.com/anonymous/1f7fdab9777e02d91ac1

On Wed, Oct 22, 2014 at 6:27 PM, Jordan Zimmerman
<jo...@jordanzimmerman.com> wrote:
> Can you provide a test that shows the problem?
>
> -JZ
>
>
> On October 22, 2014 at 5:24:06 PM, Sunil Abraham (s.abraham@gmail.com)
> wrote:
>
> Hi everyone,
>
> I am having difficulty with the the PathChildrenCache; specifically,
> the local cache, which I am accessing through the getCurrentData
> method, seems to only to get updated after I call the rebuild method.
>
> Does anyone have any thoughts?
>
> S

Re: Only getting PathChildrenCache updated after calling rebuild

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
Can you provide a test that shows the problem?

-JZ


On October 22, 2014 at 5:24:06 PM, Sunil Abraham (s.abraham@gmail.com) wrote:

Hi everyone, 

I am having difficulty with the the PathChildrenCache; specifically, 
the local cache, which I am accessing through the getCurrentData 
method, seems to only to get updated after I call the rebuild method. 

Does anyone have any thoughts? 

S