Author: mircea.markus
Date: 2008-08-20 08:06:04 -0400 (Wed, 20 Aug 2008)
New Revision: 6584
Modified:
core/trunk/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java
core/trunk/src/main/java/org/jboss/cache/jmx/ResourceDMBean.java
Log:
jmx update - name can now be associated to a MBean
Modified: core/trunk/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java 2008-08-20
12:04:27 UTC (rev 6583)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java 2008-08-20
12:06:04 UTC (rev 6584)
@@ -130,7 +130,7 @@
List<ResourceDMBean> resourceDMBeans = getResourceDMBeans();
for (ResourceDMBean resource : resourceDMBeans)
{
- String resourceName = resource.getObject().getClass().getSimpleName();
+ String resourceName = resource.getObjectName();
ObjectName objectName = new ObjectName(getObjectName(resourceName));
if (!mBeanServer.isRegistered(objectName))
{
Modified: core/trunk/src/main/java/org/jboss/cache/jmx/ResourceDMBean.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/ResourceDMBean.java 2008-08-20 12:04:27
UTC (rev 6583)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/ResourceDMBean.java 2008-08-20 12:06:04
UTC (rev 6584)
@@ -46,7 +46,7 @@
import java.util.regex.Pattern;
/**
- * This class was entirely copied from jgroups (same name there).
+ * This class was entirely copied from jgroups 2.7 (same name there).
* Couldn't simply reuse it because jgroups does not ship with MBean,
ManagedAttribute and ManagedOperation.
* Once jgroups will ship these classes, the code can be dinalmically reused from there.
*
@@ -735,6 +735,16 @@
return !atts.isEmpty() || !ops.isEmpty();
}
+ public String getObjectName()
+ {
+ MBean mBean = obj.getClass().getAnnotation(MBean.class);
+ if (mBean != null && mBean.objectName() != null &&
mBean.objectName().trim().length() > 0)
+ {
+ return mBean.objectName();
+ }
+ return obj.getClass().getSimpleName();
+ }
+
public boolean isOperationRegistred(String operationName)
{
for (MBeanOperationInfo opInfo : this.ops)
Show replies by date