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

Yang updated CURATOR-546:
-------------------------
    Description: 
I'm using AsyncCuratorFramework with cache, during testing I noticed that 

*client.cache().currentChildren(<zkPath>)* not also return the full list of 
children, by digging into *ModeledCacheImpl*, apparently some children been 
deleted when I call *client.cache().currentData(<zkPath>)*. 

What's the alternative for me if I wants to get cached node while don't remove 
it from the cache? 

 

public Optional<ZNode<T>> currentData(ZPath path)
 {
 Entry<T> entry = entries.remove(path);
 if ( entry != null )

{ return Optional.of(new ZNodeImpl<>(path, entry.stat, entry.model)); }

return Optional.empty();
 }

 

  was:
I'm using AsyncCuratorFramework with cache, during testing I noticed that 

`client.cache().currentChildren(<zkPath>)` not also return the full list of 
children, by digging into `ModeledCacheImpl`, apparently some children been 
deleted when I call `client.cache().currentData(<zkPath>)`. 

What's the alternative for me if I wants to get cached node while don't remove 
it from the cache? 

```

public Optional<ZNode<T>> currentData(ZPath path)
{
 Entry<T> entry = entries.remove(path);
 if ( entry != null )
 {
 return Optional.of(new ZNodeImpl<>(path, entry.stat, entry.model));
 }
 return Optional.empty();
}```

 


> currentData in ModeledCacheImpl removes ZPath from cache entries 
> -----------------------------------------------------------------
>
>                 Key: CURATOR-546
>                 URL: https://issues.apache.org/jira/browse/CURATOR-546
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Client
>    Affects Versions: 4.2.0
>            Reporter: Yang
>            Priority: Major
>
> I'm using AsyncCuratorFramework with cache, during testing I noticed that 
> *client.cache().currentChildren(<zkPath>)* not also return the full list of 
> children, by digging into *ModeledCacheImpl*, apparently some children been 
> deleted when I call *client.cache().currentData(<zkPath>)*. 
> What's the alternative for me if I wants to get cached node while don't 
> remove it from the cache? 
>  
> public Optional<ZNode<T>> currentData(ZPath path)
>  {
>  Entry<T> entry = entries.remove(path);
>  if ( entry != null )
> { return Optional.of(new ZNodeImpl<>(path, entry.stat, entry.model)); }
> return Optional.empty();
>  }
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to