Code example for AtomicInteger

Methods: decrementAndGet, set

0
        return this.referenceCount.incrementAndGet();
    } 
 
    private int decreaseReferece(){ 
 
        int count = this.referenceCount.decrementAndGet();
        if(count<0){
            this.referenceCount.set(0);
        } 
        log.debug("=============referenceCount:" + this.referenceCount.get());
        return this.referenceCount.get();
    } 
 
    private JMXClient(String hostName, int port, String userName, String password) throws JMXClientException {
        this.hostName = hostName;
        this.port = port;
        this.userName = userName;
        this.password = password;
        try { 
            this.address =
                    new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + this.hostName + ":" + this.port + "/jmxrmi");