You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2002/07/02 21:56:24 UTC
cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/mx DynamicMBeanProxy.java
costin 2002/07/02 12:56:24
Modified: util/java/org/apache/tomcat/util/mx DynamicMBeanProxy.java
Log:
Few changes to delay the introspection until it is neede.
Revision Changes Path
1.3 +10 -2 jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/mx/DynamicMBeanProxy.java
Index: DynamicMBeanProxy.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/mx/DynamicMBeanProxy.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DynamicMBeanProxy.java 6 Jun 2002 22:17:00 -0000 1.2
+++ DynamicMBeanProxy.java 2 Jul 2002 19:56:24 -0000 1.3
@@ -79,7 +79,7 @@
Object real;
String name;
- Method methods[];
+ Method methods[]=null;
Hashtable attMap=new Hashtable();
@@ -166,7 +166,10 @@
*/
public void setReal( Object realBean ) {
real=realBean;
+ }
+ private void init() {
+ if( methods!=null ) return;
methods = real.getClass().getMethods();
for (int j = 0; j < methods.length; ++j) {
String name=methods[j].getName();
@@ -213,7 +216,6 @@
continue;
invokeAttMap.put( name, methods[j]);
}
-
}
}
@@ -226,6 +228,9 @@
*
*/
public MBeanInfo getMBeanInfo() {
+ if( methods==null ) {
+ init();
+ }
try {
MBeanAttributeInfo attributes[]=new MBeanAttributeInfo[attMap.size()];
@@ -272,6 +277,7 @@
public Object getAttribute(String attribute)
throws AttributeNotFoundException, MBeanException, ReflectionException
{
+ if( methods==null ) init();
Method m=(Method)getAttMap.get( attribute );
if( m==null ) throw new AttributeNotFoundException(attribute);
@@ -291,6 +297,7 @@
public void setAttribute(Attribute attribute)
throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
{
+ if( methods==null ) init();
Method m=(Method)setAttMap.get( attribute.getName() );
if( m==null ) throw new AttributeNotFoundException(attribute.getName());
@@ -316,6 +323,7 @@
public Object invoke(String method, Object[] arguments, String[] params)
throws MBeanException, ReflectionException
{
+ if( methods==null ) init();
Method m=(Method)invokeAttMap.get( method );
if( m==null ) return null;
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>