[jgroups-dev] Design of a cluster wide atomic counter

Bela Ban <[email protected]> Thu, 29 Sep 2011 22:30:53 +0200
Newsgroups gmane.comp.java.javagroups.devel
Message-ID <[email protected]>
I'm designing a cluster wide counter, see [1] for details. This is a 
service which provides a cluster wide named counter, with methods get(), 
set(), incrementAndGet(), decrementAndGet() and compareAndSet(), similar 
to AtomicInteger.

So if 2 threads have a reference to a named counter "x", then each 
calling incrementAndGet() on it will ensure that they get unique values.

This was suggested by Sanne, who needs something like this in Lucene, 
but I also want to make it as generic as possible.

So I'm wondering if
- these methods make sense at all, or if all we want is only really a 
unique ID generator
- whether we need an int or a long, or both as counter
- whether there are other use cases for an atomic cluster wide counter

Your feedback and 5 cents is appreciated !


[1] 
https://github.com/belaban/JGroups/blob/JGRP-1366/doc/design/CounterService.txt

-- 
Bela Ban
Lead JGroups (http://www.jgroups.org)
JBoss / Red Hat

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Javagroups-development mailing list