User: juhalindfors
  Date: 01/12/08 08:08:17

  Modified:    src/main/test TestMX.java
  Log:
  
  
  Revision  Changes    Path
  1.3       +25 -1     jmx/src/main/test/TestMX.java
  
  Index: TestMX.java
  ===================================================================
  RCS file: /cvsroot/jboss/jmx/src/main/test/TestMX.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestMX.java       2001/12/05 21:10:33     1.2
  +++ TestMX.java       2001/12/08 16:08:17     1.3
  @@ -6,7 +6,8 @@
   
   public class TestMX {
   
  -   public static void main(String[] args) throws Exception {
  +   public static void main(String[] args)  {
  +      try {
   
         MBeanServer server = MBeanServerFactory.createMBeanServer();
         
  @@ -79,10 +80,12 @@
   
         // simple speed test, invoke printInfo 1 million times
         oname = new ObjectName("Speed:name=mymbean");
  +      
         time = System.currentTimeMillis();
         for (int i = 0; i < 1000000; ++i)
            server.invoke(oname, "printInfo", null, null);
         end = System.currentTimeMillis();
  +      
         System.out.println("1M invocations, DYNAMIC, no args, return printInfo 
string: " + (end - time));
         
         
  @@ -107,6 +110,27 @@
         end = System.currentTimeMillis();
         System.out.println("1M invocations, STANDARD, no args, no return: " + (end - 
time));
         
  +      oname = new ObjectName("standard:name=user");
  +      server.invoke(oname, "addPhoneNumber", new Object[] { "555-1234" }, new 
String[] { String.class.getName() });
  +      
  +      System.out.println(server.invoke(oname, "printInfo", null, null));
  +      
  +      
  +      server.setAttribute(oname, new Attribute("Address", "Strawberry Street"));
  +      server.setAttribute(oname, new Attribute("Password", "abcdefg"));
  +      System.out.println(server.getAttribute(oname, "Address"));
  +      System.out.println(server.invoke(oname, "printInfo", null, null));
  +      
  +      server.setAttribute(oname, new Attribute("PhoneNumbers", new String[] { 
"123-345", "123-422", "123-5242" }));
  +      System.out.println(server.invoke(oname, "printInfo", null, null));
  +   
  +      } catch (Throwable t) {
  +      if (t instanceof MBeanException) {
  +         System.out.println(t.getMessage());
  +         ((MBeanException)t).getTargetException().printStackTrace();
  +      }
  +   }
  +
      }
   
      public static interface MyRealInterface extends DynamicMBean {}
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to