Registry for modeler MBeans. This is the main entry point into modeler. It provides methods to create and manipulate model mbeans and simplify their use. This class is itself a mbean.
| 47 | * model mbeans and simplify their use. This class is itself a mbean. |
| 48 | */ |
| 49 | public class Registry implements RegistryMBean, MBeanRegistration { |
| 50 | |
| 51 | /** |
| 52 | * The Log instance to which we will write our log messages. |
| 53 | */ |
| 54 | private static final Log log = LogFactory.getLog(Registry.class); |
| 55 | private static final StringManager sm = StringManager.getManager(Registry.class); |
| 56 | |
| 57 | // Support for the factory methods |
| 58 | |
| 59 | /** |
| 60 | * The registry instance created by our factory method the first time it is called. |
| 61 | */ |
| 62 | private static Registry registry = null; |
| 63 | |
| 64 | // Per registry fields |
| 65 | |
| 66 | /** |
| 67 | * The <code>MBeanServer</code> instance that we will use to register management beans. |
| 68 | */ |
| 69 | private volatile MBeanServer server = null; |
| 70 | private final Object serverLock = new Object(); |
| 71 | |
| 72 | /** |
| 73 | * The set of ManagedBean instances for the beans this registry knows about, keyed by name. |
| 74 | */ |
| 75 | private Map<String,ManagedBean> descriptors = new HashMap<>(); |
| 76 | |
| 77 | /** |
| 78 | * List of managed beans, keyed by class name |
| 79 | */ |
| 80 | private Map<String,ManagedBean> descriptorsByClass = new HashMap<>(); |
| 81 | |
| 82 | // map to avoid duplicated searching or loading descriptors |
| 83 | private Map<String,URL> searchedPaths = new HashMap<>(); |
| 84 | |
| 85 | private Object guard; |
| 86 | |
| 87 | // Id - small ints to use array access. No reset on stop() |
| 88 | // Used for notifications |
| 89 | private final Hashtable<String,Hashtable<String,Integer>> idDomains = new Hashtable<>(); |
| 90 | private final Hashtable<String,int[]> ids = new Hashtable<>(); |
| 91 | |
| 92 | |
| 93 | // ----------------------------------------------------------- Constructors |
| 94 | |
| 95 | /** |
| 96 | * Protected constructor for Registry. Use {@link #getRegistry(Object)} to obtain an instance. |
| 97 | */ |
| 98 | protected Registry() { |
| 99 | super(); |
| 100 | } |
| 101 | |
| 102 | |
| 103 | // -------------------- Static methods -------------------- |
| 104 | // Factories |
| 105 | |
| 106 | /** |
nothing calls this directly
no test coverage detected