Registry.java 686 Bytes
package se.lil.jm;

import java.net.MalformedURLException;
import java.util.ArrayList;

public class Registry {
	private static ArrayList<JmxMon> jmxList = null;
	public static boolean test = true;
	
	public static synchronized ArrayList<JmxMon> getList() {
		if (jmxList == null) {
			jmxList = new ArrayList<JmxMon>();
		}
		return jmxList;
	}
	
	public static synchronized JmxMon findOrCreate(String conStr) throws MalformedURLException {
		for (JmxMon item : getList()) {
			if(item.getConString().equals(conStr)) {
				return item;
			}
		}
		// Not found, create it
		JmxMon monitor = new JmxMon(conStr);
		jmxList.add(monitor);
		return monitor;
	}
}