Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Zookeeper >> mail # dev >> DataTree


+
Edward Ribeiro 2013-02-13, 20:40
+
Thawan Kooburat 2013-02-14, 05:27
Cool.

I was thinking about something along the lines of
Collections.newSetFromMap(new ConcurrentHashMap<...>()) too, so that it'd
possible to get rid of synchronized like you did. Another point would be
the use of Guava's Multimaps, but then it would loose the benefits of
ConcurrentMap.

Thanks for the explanation, Thawan!

Edward

On Thu, Feb 14, 2013 at 3:27 AM, Thawan Kooburat <[EMAIL PROTECTED]> wrote:

> In our branch, where we did a lot conversion from synchronize to atomic
> variables or concurrent data structure. Our DataTree.createNode() calls
> this method to update ephemeral map
>
> private void addEphemeralPath(String path, long ephemeralOwner) {
>   if (ephemeralOwner != 0) {
>     Set<String> list = ephemerals.get(ephemeralOwner);
>     if (list == null) {
>       Set<String> newList = Collections.newSetFromMap(
>           new ConcurrentHashMap<String, Boolean>(4, 0.75f, 2));
>       list = ephemerals.putIfAbsent(ephemeralOwner, newList);
>       if (list == null) {
>         list = newList;
>       }
>     }
>     list.add(path);
>   }
>     }
>
> However, race-condition respect to write-request is not possible at the
> moment due to ZOOKEEPER-1505. The new CommitProcessor only allow 1 write
> request at any given time. So there can be only one thread that can modify
> the DataTree  (unless we remove that constraint in the future)
>
>
>
> --
> Thawan Kooburat
>
>
>
>
>
>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB