Here you can find the source of fileReaderDecrement(ConcurrentMap
public static void fileReaderDecrement(ConcurrentMap<Long, Long> readers, Long fileNum)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.ConcurrentMap; public class Main { public static void fileReaderDecrement(ConcurrentMap<Long, Long> readers, Long fileNum) { readers.compute(fileNum, (key, value) -> { if (value == null) throw new IllegalMonitorStateException("file not locked: " + fileNum); if (value.longValue() == 1L) { return null; } else { return value - 1L; }// ww w.j a v a2 s . c om }); } }