Java ConcurrentMap fileReaderDecrement(ConcurrentMap readers, Long fileNum)

Here you can find the source of fileReaderDecrement(ConcurrentMap readers, Long fileNum)

Description

file Reader Decrement

License

Open Source License

Declaration

public static void fileReaderDecrement(ConcurrentMap<Long, Long> readers, Long fileNum) 

Method Source Code

//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
        });
    }
}

Related

  1. create(boolean sorted)
  2. createConcurrentMap()
  3. createConcurrentMap()
  4. createConcurrentMap(int initial_capacity, float load_factor, int concurrency_level)
  5. extractKeySize(String sslCipherSuite)
  6. fileReaderIncrement(ConcurrentMap readers, Long fileNum)
  7. get(Class clazz)
  8. getCache(String cacheName)
  9. getConcurrentMap(int... size)