CVS update: JGroups/src/org/jgroups/jmx ResourceDMBean.java
"Bela Ban" <[email protected]>
| Newsgroups | gmane.comp.java.javagroups.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: belaban
Date: 10/09/09 10:39:07
Modified: src/org/jgroups/jmx ResourceDMBean.java
Log:
reverted: new findMethods() which inherits annotations on methods, too. Methods were getting exposed twice (superclass and subclass)...
Revision Changes Path
1.34 +20 -20 JGroups/src/org/jgroups/jmx/ResourceDMBean.java
Index: ResourceDMBean.java
===================================================================
RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/jmx/ResourceDMBean.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- ResourceDMBean.java 9 Sep 2010 09:35:20 -0000 1.33
+++ ResourceDMBean.java 9 Sep 2010 10:39:07 -0000 1.34
@@ -31,7 +31,7 @@
*
* @author Chris Mills
* @author Vladimir Blagojevic
- * @version $Id: ResourceDMBean.java,v 1.33 2010/09/09 09:35:20 belaban Exp $
+ * @version $Id: ResourceDMBean.java,v 1.34 2010/09/09 10:39:07 belaban Exp $
* @see ManagedAttribute
* @see ManagedOperation
* @see MBean
@@ -190,26 +190,26 @@
throw new ClassNotFoundException("Class " + name + " cannot be found");
}
-// private void findMethods() {
-// //find all methods but don't include methods from Object class
-// List<Method> methods = new ArrayList<Method>(Arrays.asList(getObject().getClass().getMethods()));
-// List<Method> objectMethods = new ArrayList<Method>(Arrays.asList(Object.class.getMethods()));
-// methods.removeAll(objectMethods);
-//
-// for(Method method:methods) {
-// //does method have @ManagedAttribute annotation?
-// if(method.isAnnotationPresent(ManagedAttribute.class) || method.isAnnotationPresent(Property.class)) {
-// exposeManagedAttribute(method);
-// }
-// //or @ManagedOperation
-// else if (method.isAnnotationPresent(ManagedOperation.class) || isMBeanAnnotationPresentWithExposeAll()){
-// exposeManagedOperation(method);
-// }
-// }
-// }
+ private void findMethods() {
+ //find all methods but don't include methods from Object class
+ List<Method> methods = new ArrayList<Method>(Arrays.asList(getObject().getClass().getMethods()));
+ List<Method> objectMethods = new ArrayList<Method>(Arrays.asList(Object.class.getMethods()));
+ methods.removeAll(objectMethods);
+
+ for(Method method:methods) {
+ //does method have @ManagedAttribute annotation?
+ if(method.isAnnotationPresent(ManagedAttribute.class) || method.isAnnotationPresent(Property.class)) {
+ exposeManagedAttribute(method);
+ }
+ //or @ManagedOperation
+ else if (method.isAnnotationPresent(ManagedOperation.class) || isMBeanAnnotationPresentWithExposeAll()){
+ exposeManagedOperation(method);
+ }
+ }
+ }
/** find all methods but don't include methods from Object class */
- private void findMethods() {
+ /*private void findMethods() {
for(Class<?> clazz=getObject().getClass();clazz != null; clazz=clazz.getSuperclass()) {
if(clazz.equals(Object.class))
break;
@@ -226,7 +226,7 @@
}
}
}
- }
+ }*/
private void exposeManagedOperation(Method method) {
ManagedOperation op=method.getAnnotation(ManagedOperation.class);
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd