Code example for AtomicInteger

0
    private final JMXServiceURL address;
    private JMXConnector jmxConnector;
    private MBeanServerConnection mbs;
    private RMIServer stub = null;
    private final AtomicBoolean closed = new AtomicBoolean(false);
    private final AtomicInteger referenceCount = new AtomicInteger(0);
 
    private static Map<String, JMXClient> cache = Collections.synchronizedMap(new HashMap<String, JMXClient>());
 
 
    public static JMXClient getJMXClient(String hostName, int port) throws JMXClientException {
        return getJMXClient(hostName, port, null, null);
    } 
 
 
    public static JMXClient getJMXClient(String hostName, int port, String userName, String password)
            throws JMXClientException { 
        final String key = getKey(hostName, port, userName, password);
        JMXClient jmxClient = cache.get(key);
        if (jmxClient == null) {
            jmxClient = new JMXClient(hostName, port, userName, password);