Code example for ReentrantLock

0
    } 
 
 
    public ConcurrentLRUHashMap(int capacity) {
        this.innerMap = new LRUHashMap<String, Byte>(capacity, true);
        this.lock = new ReentrantLock();
    } 
 
 
    @Override 
    public void put(String k, Byte v) {
        this.lock.lock();
        try { 
            this.innerMap.put(k, v);
        } 
        finally { 
            this.lock.unlock();
        } 
    }