Author: channa
Date: Sat May 24 23:13:33 2008
New Revision: 17336
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=17336

Log:
Using recommended 'setAttribute' method to prevent message in MASHUP-756.


Modified:
   trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java
URL: 
http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java?rev=17335&r1=17335&r2=17336&view=diff
==============================================================================
--- trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java   
(original)
+++ trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java   
Sat May 24 23:13:33 2008
@@ -75,6 +75,9 @@
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.management.ReflectionException;
+import javax.management.Attribute;
+import javax.management.AttributeNotFoundException;
+import javax.management.InvalidAttributeValueException;
 import javax.servlet.http.HttpServletRequest;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
@@ -229,7 +232,8 @@
     }
 
     /**
-     * Invokes an MBean method which sets the server run status.
+     * Invokes an MBean method which sets the server run status. Exceptions 
are not propogated up as
+     * JMX based monitoring is currently an option, so may not be used in some 
scenarios.
      *
      * @param serverRunning Server run status.
      */
@@ -243,9 +247,9 @@
                 beanName = new 
ObjectName("org.wso2.monitor.mbeans:type=ServerMonitor");
 
                 // Call notification method of mbean.
-                Object[] params = { Boolean.valueOf(serverRunning) };
-                String[] signatures = { "boolean" };
-                beanServer.invoke(beanName, "setServerRunning", params, 
signatures);
+                Attribute setServerRunning = new Attribute("ServerRunning",
+                                                           
Boolean.valueOf(serverRunning));
+                beanServer.setAttribute(beanName, setServerRunning);
             }
         } catch (InstanceNotFoundException e) {
             log.info("Named bean not found " + e.getLocalizedMessage());
@@ -255,6 +259,10 @@
             log.info("Method not called: " + e.getLocalizedMessage());
         } catch (MalformedObjectNameException e) {
             log.info("Object name incorrect when registering MBean", e);
+        } catch (AttributeNotFoundException e) {
+            log.info("Attribute not found", e);
+        } catch (InvalidAttributeValueException e) {
+            log.info("Invalid Attribute Value", e);
         }
     }
 

_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to