Code example for ConcurrentHashMap

Methods: get, putIfAbsent

0
        return url;
    } 
 
 
    private Set<Object> getReferences(final String url) {
        Set<Object> refs = this.refsCache.get(url);
        if (refs == null) {
            refs = new HashSet<Object>();
            final Set<Object> oldRefs = this.refsCache.putIfAbsent(url, refs);
            if (oldRefs != null) {
                refs = oldRefs;
            } 
        } 
        return refs;
    } 
 
 
    public void connectWithRef(final String url, Object ref) throws NotifyRemotingException {
        this.connectWithRef(url, 1, ref);
    }