Code example for AtomicInteger

Methods: addAndGet

0
 
    /* Threadsafe. Increment the reference count on the message. */ 
    public boolean incrementReference(int count)
    { 
 
        if(_referenceCount.addAndGet(count) <= 0)
        { 
            _referenceCount.addAndGet(-count);
            return false; 
        } 
        else 
        { 
            return true; 
        } 
 
    } 
 
    /** 
     * Threadsafe. This will decrement the reference count and when it reaches zero will remove the message from the 
     * message store. 
     *