Code example for ConcurrentMap

Methods: getputIfAbsent

0
    public void release(StoreTransaction tx, KeyColumn kc) {
        getLocksForTx(tx).remove(kc);
    } 
 
    public Map<KeyColumn, S> getLocksForTx(StoreTransaction tx) {
        Map<KeyColumn, S> m = locks.get(tx);
 
        if (null == m) {
            m = new HashMap<KeyColumn, S>();
            final Map<KeyColumn, S> x = locks.putIfAbsent(tx, m);
            if (null != x) {
                m = x;
            } 
        } 
 
        return m;
    } 
}