have a look at Cliff Click&#39;s ConcurrentAutoTable (github fork link for easy viewing):<div><br></div><div><a href="https://github.com/boundary/high-scale-lib/blob/master/src/main/java/org/cliffc/high_scale_lib/ConcurrentAutoTable.java">https://github.com/boundary/high-scale-lib/blob/master/src/main/java/org/cliffc/high_scale_lib/ConcurrentAutoTable.java</a><br>
<br></div><div>original source in sourceforge:</div><div><br></div><div><a href="http://sourceforge.net/projects/high-scale-lib/">Highly Scalable Java | Download Highly Scalable Java software for ...</a></div><div><br><div class="gmail_quote">
On Sun, Aug 14, 2011 at 9:03 PM, Jeff Hain <span dir="ltr">&lt;<a href="mailto:jeffhain@rocketmail.com">jeffhain@rocketmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div><br>   That could work well for some cases indeed, but I&#39;m working on a sort<br>of Disruptor, using the counter with modulo to pick up slots to write to in<br>
a cyclic array, monotonically, or non-monotonically but for a short time<br>(for readers not to be blocked on a not-yet-written slot), and any writer<br>can stop to work anytime; in this case I don&#39;t see how that could apply<br>
easily.<br><br>-Jeff<br></div><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><br><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight:bold">De :</span></b> Aleksey Shipilev &lt;<a href="mailto:aleksey.shipilev@gmail.com" target="_blank">aleksey.shipilev@gmail.com</a>&gt;<br>
<b><span style="font-weight:bold">À :</span></b> Jeff Hain
 &lt;<a href="mailto:jeffhain@rocketmail.com" target="_blank">jeffhain@rocketmail.com</a>&gt;<br><b><span style="font-weight:bold">Cc :</span></b> <a href="mailto:concurrency-interest@cs.oswego.edu" target="_blank">concurrency-interest@cs.oswego.edu</a><br>
<b><span style="font-weight:bold">Envoyé le :</span></b> Dim 14 août 2011, 1h 13min 57s<br><b><span style="font-weight:bold">Objet :</span></b> Re: [concurrency-interest] concurrent counter : incrementAndGet<br></font><div class="im">
<br>You might want to get the idea from JPA-s sequencers like this: get<br>each caller thread its own local range of numbers it can count, once<br>thread depletes the region, atomically allocate another region. You<br>can then greatly reduce contention by controlling region range. This<br>
is still provide unique values in every thread, with some<br>non-monotonic perturbations.<br><br>-Aleksey.<br><br>On Sun, Aug 14, 2011 at 2:57 AM, Jeff Hain &lt;<a href="mailto:jeffhain@rocketmail.com" target="_blank">jeffhain@rocketmail.com</a>&gt; wrote:<br>
&gt; Hello.<br>&gt;<br>&gt;
    To continue on the subject of concurrent counters, does anyone<br>&gt; know one that could be used instead of AtomicLong.incrementAndGet()<br>&gt; (possibly providing non-monotonic results, or monotonic but with gaps),<br>
&gt; and would scale better?<br>&gt;<br>&gt;    I tried to do something in that direction, but it&#39;s sometimes actually<br>&gt; worse<br>&gt; (which still surprises me: I&#39;m not totally aware of what I carefully made<br>
&gt; yet ;).<br>&gt;<br>&gt; Regards,<br>&gt;<br>&gt; Jeff<br>&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; Concurrency-interest mailing list<br>&gt; <a href="mailto:Concurrency-interest@cs.oswego.edu" target="_blank">Concurrency-interest@cs.oswego.edu</a><br>
&gt; <a href="http://cs.oswego.edu/mailman/listinfo/concurrency-interest" target="_blank">http://cs.oswego.edu/mailman/listinfo/concurrency-interest</a><br>&gt;<br>&gt;<br></div></div></div>
</div></div><br>_______________________________________________<br>
Concurrency-interest mailing list<br>
<a href="mailto:Concurrency-interest@cs.oswego.edu">Concurrency-interest@cs.oswego.edu</a><br>
<a href="http://cs.oswego.edu/mailman/listinfo/concurrency-interest" target="_blank">http://cs.oswego.edu/mailman/listinfo/concurrency-interest</a><br>
<br></blockquote></div><br></div>