Examples of MBeanServerConnection


Examples of javax.management.MBeanServerConnection

    JMXConnector jmxc = null;
    try {
      int jmxPort = WGADesignerPlugin.getDefault().getPreferenceStore().getInt(PreferenceConstants.JMX_PORT);     
      JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:" + jmxPort + "/jmxrmi");
          jmxc = JMXConnectorFactory.connect(url, null);
          MBeanServerConnection mbean = jmxc.getMBeanServerConnection();
      Object attribute = mbean.getAttribute(new ObjectName("de.innovationgate.WGAMonitor:context=WGAPublisher,name=Information"), "CoreStatus");
      if (attribute != null && attribute instanceof Integer) {       
        return (Integer) attribute;       
      } else {
        return -1;
      }
View Full Code Here

Examples of javax.management.MBeanServerConnection

    try {
      JMXServiceURL url = new JMXServiceURL(
          "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi");
      JMXConnector jmxc = JMXConnectorFactory.connect(url, null);

      MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();

      ObjectName adaptor = new ObjectName("xBus:mbean=Administrator");

      AdministratorMBean mbeanProxy = JMX.newMBeanProxy(mbsc, adaptor,
          AdministratorMBean.class, true);
View Full Code Here

Examples of javax.management.MBeanServerConnection

    public static void main(String[] args)
        throws Exception {

        JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9999/testApp");
        JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
        MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
        mbsc.addNotificationListener(
                new ObjectName("jmanage:name=TimeNotificationBroadcaster"),
                new MyNotificationListener(), null, null);

        while(true){
            try {
View Full Code Here

Examples of javax.management.MBeanServerConnection

    public ServerConnection getServerConnection(ApplicationConfig config)
            throws ConnectionFailedException {

        try {
            MBeanServerConnection mbsc = ConnectorRegistry.getInstance(config).getMBeanServer();
            return new ConnectorAgentConnection(mbsc);
        } catch (Throwable ex) {
            throw new ConnectionFailedException(ex);
        }
    }
View Full Code Here

Examples of javax.management.MBeanServerConnection

      // doesn't do message redistribution.
     
      // You won't have to do this in your own programs - you just need to make sure your postoffice
      // MBean config specifies the DefaultMessagePullPolicy
     
      MBeanServerConnection mBeanServer = lookupMBeanServerProxy(ic);
     
      ObjectName postOfficeObjectName = new ObjectName("jboss.messaging:service=PostOffice");

      mBeanServer.invoke(postOfficeObjectName, "stop", null, null);
     
      Attribute att =
         new Attribute("MessagePullPolicy",
                       "org.jboss.messaging.core.plugin.postoffice.cluster.NullMessagePullPolicy");
     
      mBeanServer.setAttribute(postOfficeObjectName, att);

      // Restart the post office
     
      mBeanServer.invoke(postOfficeObjectName, "start", null, null);
   }
View Full Code Here

Examples of javax.management.MBeanServerConnection

      mBeanServer.invoke(postOfficeObjectName, "start", null, null);
   }

   public static void deployQueue(String jndiName, InitialContext ic) throws Exception
   {
      MBeanServerConnection mBeanServer = lookupMBeanServerProxy(ic);

      ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer");

      String queueName = jndiName.substring(jndiName.lastIndexOf('/') + 1);

      mBeanServer.invoke(serverObjectName, "createQueue",
                         new Object[] {queueName, jndiName},
                         new String[] {"java.lang.String", "java.lang.String"});

      System.out.println("Queue " + jndiName + " deployed");
   }
View Full Code Here

Examples of javax.management.MBeanServerConnection

       undeployQueue(jndiName,null);
   }

   public static void undeployQueue(String jndiName, InitialContext ic) throws Exception
   {
      MBeanServerConnection mBeanServer = lookupMBeanServerProxy(ic);

      ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer");

      String queueName = jndiName.substring(jndiName.lastIndexOf('/') + 1);

      mBeanServer.invoke(serverObjectName, "destroyQueue",
                         new Object[] {queueName},
                         new String[] {"java.lang.String"});

      System.out.println("Queue " + jndiName + " undeployed");
   }
View Full Code Here

Examples of javax.management.MBeanServerConnection

   {
      String serverName = InetAddress.getLocalHost().getHostName();
      String serverURL = "service:jmx:rmi:///jndi/rmi://" + serverName +":1090/jmxrmi";
      JMXServiceURL url = new JMXServiceURL(serverURL);
      JMXConnector jmxc = JMXConnectorFactory.connect(url, new HashMap());
      MBeanServerConnection server1 = jmxc.getMBeanServerConnection();

      // TODO: get the port from binding service
      serverURL = "service:jmx:rmi:///jndi/rmi://" + serverName +":1190/jmxrmi";
      url = new JMXServiceURL(serverURL);
      jmxc = JMXConnectorFactory.connect(url, new HashMap());
      server2 = jmxc.getMBeanServerConnection();

      ObjectName testerName = new ObjectName("jboss.aop:name=CacheTester");

      int baseAge = 32;
     

      for (int j = 0; j < 5; j++)
      {
         {
            // Just to be absolutely sure that server1 and server2 are different VMs
            Object[] params = {};
            String[] sig = {};
            System.out.println("vmid server1: " + server1.invoke(testerName, "getVMID", params, sig));
            System.out.println("vmid server2: " + server2.invoke(testerName, "getVMID", params, sig));
           
         }
         {
            Object[] params = {"Bill"};
            String[] sig = {"java.lang.String"};
            Integer age1 = (Integer)server1.invoke(testerName, "getAge", params, sig);
            System.out.println("server1 age: " + age1);
           
            Integer age2 = (Integer)server2.invoke(testerName, "getAge", params, sig);
            System.out.println("server2 age: " + age2);
         }
         {
            System.out.println("set age to " + ++baseAge + " on server1");
            Object[] params = {"Bill", new Integer(baseAge)};
            String[] sig = {"java.lang.String", "int"};
            server1.invoke(testerName, "setAge", params, sig);
         }
         {
            System.out.println("check age");
            Object[] params = {"Bill"};
            String[] sig = {"java.lang.String"};
            Integer age1 = (Integer)server1.invoke(testerName, "getAge", params, sig);
            System.out.println("server1 age: " + age1);
           
            Integer age2 = (Integer)server2.invoke(testerName, "getAge", params, sig);
            System.out.println("server2 age: " + age2);
         }
         {
            Object[] params = {"Bill"};
            String[] sig = {"java.lang.String"};
            List hobbies = (List)server1.invoke(testerName, "getHobbies", params, sig);
            System.out.println("server1 hobbies: ");
            for (int i = 0; i < hobbies.size(); i++)
            {
               System.out.println("   " + hobbies.get(i));
         }
           
            hobbies = (List)server2.invoke(testerName, "getHobbies", params, sig);
            System.out.println("server2 hobbies: ");
            for (int i = 0; i < hobbies.size(); i++)
            {
               System.out.println("   " + hobbies.get(i));
            }
         }
         {
            System.out.println("addHobby fishing");
            Object[] params = {"Bill", "fishing"};
            String[] sig = {"java.lang.String", "java.lang.String"};
            server1.invoke(testerName, "addHobby", params, sig);
         }
         {
            Object[] params = {"Bill"};
            String[] sig = {"java.lang.String"};
            List hobbies = (List)server1.invoke(testerName, "getHobbies", params, sig);
            System.out.println("server1 hobbies: ");
            for (int i = 0; i < hobbies.size(); i++)
            {
               System.out.println("   " + hobbies.get(i));
            }
           
            hobbies = (List)server2.invoke(testerName, "getHobbies", params, sig);
            System.out.println("server2 hobbies: ");
            for (int i = 0; i < hobbies.size(); i++)
            {
               System.out.println("   " + hobbies.get(i));
            }
         }
         {
            Object[] params = {"Bill"};
            String[] sig = {"java.lang.String"};
            String city1= (String)server1.invoke(testerName, "getCity", params, sig);
            System.out.println("server1 city: " + city1);
           
            String city2 = (String)server2.invoke(testerName, "getCity", params, sig);
            System.out.println("server2 city: " + city2);
         }
         {
            System.out.println("set city to Atlanta");
            Object[] params = {"Bill", "Atlanta" + baseAge};
            String[] sig = {"java.lang.String", "java.lang.String"};
            server1.invoke(testerName, "setCity", params, sig);
         }
         {
            Object[] params = {"Bill"};
            String[] sig = {"java.lang.String"};
            String city1= (String)server1.invoke(testerName, "getCity", params, sig);
            System.out.println("server1 city: " + city1);
           
            String city2 = (String)server2.invoke(testerName, "getCity", params, sig);
            System.out.println("server2 city: " + city2);
         }
View Full Code Here

Examples of javax.management.MBeanServerConnection

   }
 
   public void testValueFactoryInjection() throws Exception
   {     
      ObjectName oname = new ObjectName(targetObject);
      MBeanServerConnection adaptor = this.getServer();
      Integer val = (Integer) adaptor.getAttribute(oname, "FromPojo");
      assertNotNull(val);
      assertEquals(3, val.intValue());
      val = (Integer) adaptor.getAttribute(oname, "FromMBean");
      assertNotNull(val);
      assertEquals(7, val.intValue());
      val = (Integer) adaptor.getAttribute(oname, "FromDefault");
      assertNotNull(val);
      assertEquals(5, val.intValue());
   }
View Full Code Here

Examples of javax.management.MBeanServerConnection

   private boolean removeDataSource(String module, String template,
         HashMap props) throws Exception
   {
      log.info("removeDataSource('" + module + "', '" + template + "', "
            + props);
      MBeanServerConnection server = getServer();

      // remove the data source
      module = (String) server
            .invoke(deploymentService, "removeDataSource", new Object[] {
                  module, template, props }, new String[] { "java.lang.String",
                  "java.lang.String", "java.util.HashMap" });

      // sleep for 3 secs to allow the datasource to be undeployed first
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.