Java atomic classes in compound operations
<p>Will the following code cause race condition issue if several threads invoke the "incrementCount" method?</p>

<pre><code>public class sample {

       private AtomicInteger counter = new AtomicInteger(0);

       public int getCurrentCount {
          int current = counter.getAndIncrement();
          if (counter.compareAndSet(8, 0)) current = 0;
          return current;
      }
}
</code></pre>

<p>If it causes race condition, what are the possible solution other than using synchronized keyword?</p>
