Как получить экземпляр класса привязки MBean

Я пытаюсь связать экземпляр класса обслуживания вjboss-service.xml используя MBean.

JBoss-Service.xml определилBasicThreadPool который мы хотим использовать в нашем коде. Это то, что вJBOSS-Service.xml.

  <mbean 
        code="org.jboss.util.threadpool.BasicThreadPool"
        name="jboss.system:service=ThreadPool">

  <attribute name="Name">JBoss System Threads</attribute>
  <attribute name="ThreadGroupName">System Threads</attribute>
  <attribute name="KeepAliveTime">60000</attribute>
  <attribute name="MaximumPoolSize">10</attribute>

  <attribute name="MaximumQueueSize">1000</attribute>
  <!-- The behavior of the pool when a task is added and the queue is full.
  abort - a RuntimeException is thrown
  run - the calling thread executes the task
  wait - the calling thread blocks until the queue has room
  discard - the task is silently discarded without being run
  discardOldest - check to see if a task is about to complete and enque
     the new task if possible, else run the task in the calling thread
  -->
  <attribute name="BlockingMode">run</attribute>
   </mbean>

Я пытаюсь получить доступ к этому в моем коде, как показано ниже,

MBeanServer server = MBeanServerLocator.locateJBoss();          
MBeanInfo mbeaninfo = server.getMBeanInfo(new ObjectName("jboss.system:service=ThreadPool"));

Теперь у меня есть информация MBean. Я хочу иметь экземплярBasicThreadPool объект, определенный в MBean. Является ли это возможным ?

Я знаю способ, которым мы можем получить имя класса из MBean Info, а также мы можем получить атрибуты, по которым мы можем создать экземпляр. Есть ли лучший способ сделать это?

Ответы на вопрос(2)

Ваш ответ на вопрос