public Counter get(String name, int type) {
		if (name == null || name.length() == 0)
			throw new NullPointerException("Counter name was not set");

		synchronized (_lock) {
			resetIfNeeded();
			Counter counter = _cache.get(name);
			if (counter == null || counter.getType() != type) {
				counter = new Counter(name, type);
				_cache.put(name, counter);
			}

			return counter;
		}
	}
public Counter get ( String name , int type ) { if ( name == null || name . length ( ) == 0 ) throw new NullPointerException ( "Counter name was not set" ) ; synchronized ( _lock ) { resetIfNeeded ( ) ; Counter counter = _cache . get ( name ) ; if ( counter == null || counter . getType ( ) != type ) { counter = new Counter ( name , type ) ; _cache . put ( name , counter ) ; } return counter ; } }
Gets a counter specified by its name. It counter does not exist or its type
doesn't match the specified type it creates a new one.

@param name a counter name to retrieve.
@param type a counter type.
@return an existing or newly created counter of the specified type.