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

Reply via email to