1 22 package org.jboss.test.jbossmx.performance.dynamic.support; 23 24 import javax.management.*; 25 26 33 public class Dyn 34 implements DynamicMBean 35 { 36 37 private int counter = 0; 38 39 public Object getAttribute(String attribute) 40 throws AttributeNotFoundException, MBeanException, ReflectionException 41 { 42 return null; 43 } 44 45 public void setAttribute(Attribute attribute) 46 throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException 47 {} 48 49 public AttributeList getAttributes(String [] attributes) 50 { 51 return null; 52 } 53 54 public AttributeList setAttributes(AttributeList attributes) 55 { 56 return null; 57 } 58 59 public Object invoke(String actionName, Object [] params, String [] signature) 60 throws MBeanException, ReflectionException 61 { 62 if (actionName.equals("methodInvocation")) 63 { 64 methodInvocation(); 65 return null; 66 } 67 68 else if (actionName.equals("counter")) 69 { 70 countInvocation(); 71 return null; 72 } 73 74 else if (actionName.equals("mixedArguments")) 75 { 76 myMethod((Integer )params[0], ((Integer )params[1]).intValue(), 77 (Object [][][])params[2], (Attribute)params[3]); 78 79 return null; 80 } 81 82 return null; 83 } 84 85 public MBeanInfo getMBeanInfo() 86 { 87 88 return new MBeanInfo( 89 "test.performance.dynamic.support.Dynamic", "", 90 null, 91 null, 92 new MBeanOperationInfo[] { 93 new MBeanOperationInfo( 94 "methodInvocation", "", 95 null, void.class.getName(), 0) 96 , 97 new MBeanOperationInfo( 98 "counter", "", 99 null, void.class.getName(), 0) 100 }, 101 null 102 ); 103 } 104 105 private void methodInvocation() 106 {} 107 108 private void countInvocation() 109 { 110 ++counter; 111 } 112 113 public void myMethod(Integer int1, int int2, Object [][][] space, Attribute attr) 114 { 115 116 } 117 118 public int getCount() 119 { 120 return counter; 121 } 122 } 123 124 125 126 127 | Popular Tags |