Code example for AtomicLong

Methods: incrementAndGet

0
        this.actorContext = context; 
    } 
 
    @Override 
    public void receive(Object msg, ActorRef sender) throws Exception { 
        long count = counter.incrementAndGet(); 
 
        if (count % 10000000 == 0) { 
            System.out.println(actorContext.self() + " is at: " + count); 
        } 
    } 
 
    public void assertCountEventually(long count) { 
        for (int k = 0; k < 600; k++) { 
            if (counter.get() == count) return; 
            Util.sleep(1000); 
 
        } 
        fail(); 
    } 
}