Code example for AtomicLong

Methods: addAndGet

0
        return -1L; 
    } 
 
    public void restoreCredit(long messageCredit, long bytesCredit)
    { 
        _messageCredit.addAndGet(messageCredit);
        setSuspended(false); 
 
    } 
 
    public void removeAllCredit() 
    { 
        setSuspended(true); 
        _messageCredit.set(0L);
    } 
 
    public boolean hasCredit() 
    { 
        return _messageCredit.get() > 0L;
    }