API to Invoke Multiple MBeans


package com.mbeans;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;

import com.connection.GetJMXConnector;
public class MultipleMBeanInvoke {
 public static void main(String[] args) throws Exception {
  
  
  JMXConnector connector = GetJMXConnector.getJMXConnection();
  MBeanServerConnection conn = connector.getMBeanServerConnection();
  
  System.out.println("Connection Established For mbean server.");
  //Object Name u can get from EM console Show Mbean Information
  ObjectName name = new ObjectName("oracle.iam:Location=oim_server1,name=APPIDSeedingMBean,type=IAMAppRuntimeMBean,Application=oim,ApplicationVersion=11.1.2.0.0");
  
  String[] sig = new String[] {
   String.class.getName()
  };
  
  
  for (int i=0 ; i<3 ; i++) {  
   String[] params = new String[] {
    "TESTAPPID" + i
   };
   //Operations present in Application Defined MBeans: IAMAppRuntimeMBean:APPIDSeedingMBean

   System.out.println("before invoking mbean count=" + i);
   Object ret = conn.invoke(name, "registerAPPID", params, sig);
     
   System.out.println("ret = " + ret.toString());
   Thread.sleep(5000);
   
  }
 }

}

No comments:

Post a Comment

About OIM

Oracle Identity Management enables organizations to effectively manage the end - to - end life - cycle of user ide...

Popular Posts