Hi Eric,

I just added a test for this to 3.2 jmx testsuite. It works for me.

One obvious point. The meta data you get from (Model)MBeanInfo is all
cloned before you get access. Changing the values has no affect,
you are modifying a copy.

Regards,
Adrian

xxxxxxxxxxxxxxxxxxxxxxxx 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
xxxxxxxxxxxxxxxxxxxxxxxx 
 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Eric Jain
> Sent: 20 June 2003 17:06
> To: jboss-user
> Subject: [JBoss-user] Setting XMBean attributes to read-only 
> at run time
> 
> 
> What's wrong with the following code? It runs, but without any effect.
> 
>   /**
>    * @jmx.managed-operation
>    *     impact="ACTION"
>    */
>  
>   public void setReadOnly()
>     throws Exception
>   {
>     ModelMBeanInfo info = (ModelMbeanInfo) server.getMBeanInfo(name);
>     // Direct invocation of getModelMbeanInfo() returns null!
>     MBeanAttributeInfo[] infos = info.getAttributes();
>   
>     for (int i = 0; i < infos.length; ++i)
>     {
>       if (infos[i].isWritable())
>       {
>         log.debug("Setting field read-only: " + infos[i].getName());
>         infos[i] = new ModelMBeanAttributeInfo(
>           infos[i].getName(), 
>           infos[i].getType(),
>           infos[i].getDescription(), 
>           infos[i].isReadable(),
>           false,
>           infos[i].isIs());
>       }
>     }
> 
>     // Can't do setModelMBeanInfo(info), NullPointerException!
>   }
> 
> 
> --
> Eric Jain
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: INetU
> Attention Web Developers & Consultants: Become An INetU 
> Hosting Partner.
> Refer Dedicated Servers. We Manage Them. You Get 10% Monthly 
> Commission!
> INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 





-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to