Code example for AtomicInteger

Methods: addAndGet

    /* Threadsafe. Increment the reference count on the message. */ 
    public boolean incrementReference(int count)
        if(_referenceCount.addAndGet(count) <= 0)
            return false; 
            return true; 
     * Threadsafe. This will decrement the reference count and when it reaches zero will remove the message from the 
     * message store. 
Stop searching for code, let great code find you!  Add Codota to your java IDE