User: juhalindfors Date: 01/12/06 13:43:19 Modified: src/main/org/jboss/mx/server/registry BasicMBeanRegistry.java Log: JBoss style: from K&R to ANSI C Revision Changes Path 1.4 +40 -17 jmx/src/main/org/jboss/mx/server/registry/BasicMBeanRegistry.java Index: BasicMBeanRegistry.java =================================================================== RCS file: /cvsroot/jboss/jmx/src/main/org/jboss/mx/server/registry/BasicMBeanRegistry.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- BasicMBeanRegistry.java 2001/12/06 21:23:41 1.3 +++ BasicMBeanRegistry.java 2001/12/06 21:43:19 1.4 @@ -1,5 +1,8 @@ /* - * LGPL + * JBoss, the OpenSource J2EE webOS + * + * Distributable under LGPL license. + * See terms of license at gnu.org. */ package org.jboss.mx.server.registry; @@ -11,36 +14,56 @@ import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap; -public class BasicMBeanRegistry implements MBeanRegistry { - +/** + * The registry for object name - object reference mapping in the + * MBean server. + * <p> + * The implementation of this class affects the invocation speed + * directly, please check any changes for performance. + * + * @see org.jboss.mx.MBeanRegistry + * + * @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>. + * @version $Revision: 1.4 $ + */ +public class BasicMBeanRegistry + implements MBeanRegistry +{ + // Attributes ---------------------------------------------------- private Map mbeanMap = new ConcurrentReaderHashMap(); + - public void add(MBeanEntry e) { + // Public -------------------------------------------------------- + public void add(MBeanEntry e) + { mbeanMap.put(e.getObjectName(), e); } - - public void remove(ObjectName name) throws InstanceNotFoundException { - Object o = mbeanMap.remove(name); + + public void remove(ObjectName name) throws InstanceNotFoundException + { + Object o = mbeanMap.remove(name); if (o == null) throw new InstanceNotFoundException(name + " not registered."); } - - public MBeanEntry get(ObjectName name) throws InstanceNotFoundException { + + public MBeanEntry get(ObjectName name) throws InstanceNotFoundException + { MBeanEntry entry = (MBeanEntry)mbeanMap.get(name); - + if (entry == null) throw new InstanceNotFoundException(name + " not registered."); - + return entry; } - - public boolean contains(ObjectName name) { + + public boolean contains(ObjectName name) + { return mbeanMap.containsKey(name); } - - public int getSize() { + + public int getSize() + { return mbeanMap.size(); } - - } +
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development