All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.caiguoqing.uyuni.rpc.pub.MapInterCount Maven / Gradle / Ivy

The newest version!
/**
 * 
 */
package org.caiguoqing.uyuni.rpc.pub;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author caiguoqing0427
 *
 */
public class MapInterCount implements InterCount {
	Map counts = new HashMap();

	/* (non-Javadoc)
	 * @see org.caiguoqing.uyuni.rpc.pub.InterCount#add(java.lang.String)
	 */
	public synchronized void add(String method) {
		counts.put(method, method(method)+1);
	}

	/* (non-Javadoc)
	 * @see org.caiguoqing.uyuni.rpc.pub.InterCount#method()
	 */
	public Set method() {
		return counts.keySet();
	}

	/* (non-Javadoc)
	 * @see org.caiguoqing.uyuni.rpc.pub.InterCount#method(java.lang.String)
	 */
	public long method(String method) {
		Long count = counts.get(method);
		if(count == null){
			count = 0L;
		}
		return count;
	}

	/* (non-Javadoc)
	 * @see org.caiguoqing.uyuni.rpc.pub.InterCount#getAll()
	 */
	public Map getAll() {
		return new HashMap(counts);
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy