curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiaoshuang LU (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CURATOR-216) PathChildrenCacheListener could not receive CHILD_UPDATED events
Date Sat, 09 May 2015 11:29:59 GMT

     [ https://issues.apache.org/jira/browse/CURATOR-216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Xiaoshuang LU updated CURATOR-216:
----------------------------------
    Description: 
Here is the scenario which can reproduce this issue.
{code}
    public void testChildUpdated() throws Exception
    {
        Timing timing = new Timing();
        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(),
timing.session(), timing.connection(), new RetryOneTime(1));
        client.start();
        try
        {
            final CountDownLatch updatedLatch = new CountDownLatch(1);
            client.create().creatingParentsIfNeeded().forPath("/test");
            PathChildrenCache cache = new PathChildrenCache(client, "/test", false);
            cache.getListenable().addListener
                (
                    new PathChildrenCacheListener()
                    {
                        @Override
                        public void childEvent(CuratorFramework client, PathChildrenCacheEvent
event) throws Exception
                        {
                            if ( event.getType() == PathChildrenCacheEvent.Type.CHILD_UPDATED
)
                            {
                                updatedLatch.countDown();
                            }
                        }
                    }
                );
            cache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
            client.create().forPath("/test/foo", "first".getBytes());
            client.setData().forPath("/test/foo", "something new".getBytes());
            updatedLatch.await();
        }
        finally
        {
            CloseableUtils.closeQuietly(client);
        }
    }
{code}
The function will be blocked on "updatedLatch.await();".

  was:
case to reproduce the issue
{code}
    public void testChildUpdated() throws Exception
    {
        Timing timing = new Timing();
        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(),
timing.session(), timing.connection(), new RetryOneTime(1));
        client.start();
        try
        {
            final CountDownLatch updatedLatch = new CountDownLatch(1);
            client.create().creatingParentsIfNeeded().forPath("/test");
            PathChildrenCache cache = new PathChildrenCache(client, "/test", false);
            cache.getListenable().addListener
                (
                    new PathChildrenCacheListener()
                    {
                        @Override
                        public void childEvent(CuratorFramework client, PathChildrenCacheEvent
event) throws Exception
                        {
                            if ( event.getType() == PathChildrenCacheEvent.Type.CHILD_UPDATED
)
                            {
                                updatedLatch.countDown();
                            }
                        }
                    }
                );
            cache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
            client.create().forPath("/test/foo", "first".getBytes());
            client.setData().forPath("/test/foo", "something new".getBytes());
            Assert.assertTrue(timing.awaitLatch(updatedLatch));
        }
        finally
        {
            CloseableUtils.closeQuietly(client);
        }
    }
{code}


> PathChildrenCacheListener could not receive CHILD_UPDATED events
> ----------------------------------------------------------------
>
>                 Key: CURATOR-216
>                 URL: https://issues.apache.org/jira/browse/CURATOR-216
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Recipes
>    Affects Versions: 2.6.0, 2.7.0, 2.7.1
>            Reporter: Xiaoshuang LU
>            Priority: Blocker
>
> Here is the scenario which can reproduce this issue.
> {code}
>     public void testChildUpdated() throws Exception
>     {
>         Timing timing = new Timing();
>         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(),
timing.session(), timing.connection(), new RetryOneTime(1));
>         client.start();
>         try
>         {
>             final CountDownLatch updatedLatch = new CountDownLatch(1);
>             client.create().creatingParentsIfNeeded().forPath("/test");
>             PathChildrenCache cache = new PathChildrenCache(client, "/test", false);
>             cache.getListenable().addListener
>                 (
>                     new PathChildrenCacheListener()
>                     {
>                         @Override
>                         public void childEvent(CuratorFramework client, PathChildrenCacheEvent
event) throws Exception
>                         {
>                             if ( event.getType() == PathChildrenCacheEvent.Type.CHILD_UPDATED
)
>                             {
>                                 updatedLatch.countDown();
>                             }
>                         }
>                     }
>                 );
>             cache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
>             client.create().forPath("/test/foo", "first".getBytes());
>             client.setData().forPath("/test/foo", "something new".getBytes());
>             updatedLatch.await();
>         }
>         finally
>         {
>             CloseableUtils.closeQuietly(client);
>         }
>     }
> {code}
> The function will be blocked on "updatedLatch.await();".



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message