Code example for AtomicInteger

0
@Ignore 
public class ConsistStrategyUnitTest extends BaseStrategyUnitTest { 
 
    private final LoadBalanceStrategy strategy = new ConsisHashStrategy();
 
    private final AtomicInteger counter = new AtomicInteger(0);
 
 
    @Override 
    public List<String> createConsumers(final int num) throws Exception {
        final List<String> rt = new ArrayList<String>();
        for (int i = 0; i < num; i++) {
            rt.add("consumer-" + RemotingUtils.getLocalHostAddress() + "-" + System.currentTimeMillis() + "-"
                    + this.counter.incrementAndGet());
        } 
        return rt;
    } 
 
 
    @Test 
    public void testGetPartitions_4consumers_10partitions() throws Exception {