[jboss-cvs] JBossAS SVN: r94660 - branches/Branch_5_x/mbeans/src/main/org/jboss/mx/metadata.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 12 02:54:23 EDT 2009
Author: alesj
Date: 2009-10-12 02:54:22 -0400 (Mon, 12 Oct 2009)
New Revision: 94660
Modified:
branches/Branch_5_x/mbeans/src/main/org/jboss/mx/metadata/MBeanCapability.java
Log:
No need for a new instance every time, class is immutable.
Modified: branches/Branch_5_x/mbeans/src/main/org/jboss/mx/metadata/MBeanCapability.java
===================================================================
--- branches/Branch_5_x/mbeans/src/main/org/jboss/mx/metadata/MBeanCapability.java 2009-10-12 06:21:48 UTC (rev 94659)
+++ branches/Branch_5_x/mbeans/src/main/org/jboss/mx/metadata/MBeanCapability.java 2009-10-12 06:54:22 UTC (rev 94660)
@@ -51,6 +51,7 @@
*
* @author <a href="mailto:trevor at protocool.com">Trevor Squires</a>.
* @author thomas.diesler at jboss.org
+ * @author ales.justin at jboss.org
*/
public class MBeanCapability
{
@@ -58,6 +59,9 @@
public static final int STANDARD_MBEAN = 0x123;
public static final int NOT_AN_MBEAN = 0xc0de;
+ private static final MBeanCapability DYNAMIC_CONST = new MBeanCapability(DYNAMIC_MBEAN);
+ private static final MBeanCapability STANDARD_CONST = new MBeanCapability(STANDARD_MBEAN);
+
protected int mbeanType = NOT_AN_MBEAN;
private MBeanCapability(int type)
@@ -80,7 +84,7 @@
// If MyClass is an instance of the DynamicMBean interface, MyClass is a dynamic MBean.
if (DynamicMBean.class.isAssignableFrom(mbeanClass))
{
- return new MBeanCapability(DYNAMIC_MBEAN);
+ return DYNAMIC_CONST;
}
// If the MyClass MBean is an instance of a MyClassMBean interface, MyClass is a standard MBean
@@ -90,7 +94,7 @@
Class anInterface = interfaces[i];
if (anInterface.getName().equals(mbeanClass.getName() + "MBean"))
{
- return new MBeanCapability(STANDARD_MBEAN);
+ return STANDARD_CONST;
}
}
More information about the jboss-cvs-commits
mailing list