Java ConcurrentMap getNewLogFactor(String factorName)

Here you can find the source of getNewLogFactor(String factorName)

Description

get New Log Factor

License

Open Source License

Declaration

private static int getNewLogFactor(String factorName) 

Method Source Code

//package com.java2s;
/**/*from   w w  w. java  2 s .  c om*/
 * Project: avatar-cache
 * 
 * File Created at 2011-9-13
 * $Id$
 * 
 * Copyright 2010 dianping.com.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Dianping Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with dianping.com.
 */

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class Main {
    private static ConcurrentMap<String, Integer> logFactorMap = new ConcurrentHashMap<String, Integer>();

    private static int getNewLogFactor(String factorName) {
        Integer newFactor = null;
        if (logFactorMap.containsKey(factorName)) {
            Integer oldFactor = logFactorMap.get(factorName);
            newFactor = oldFactor + 1;
            logFactorMap.put(factorName, newFactor);
        } else {
            logFactorMap.put(factorName, 0);
            newFactor = 0;
        }
        return newFactor;
    }
}

Related

  1. getCache(String cacheName)
  2. getConcurrentMap(int... size)
  3. getContextPath()
  4. getFilesystem(String id)
  5. getNestedSet(K1 key, ConcurrentMap> set)
  6. getSingleInstance(Class classType)
  7. getTypeFromKind(String kind)
  8. is(Class clazz, Collection> clazzes, ConcurrentMap, Boolean> cache)
  9. isClassClass(Class clazz)