Package javax.management

Examples of javax.management.MBeanServer


      try
      {
         assertServiceRunning(NAME_ONE);
         assertNoService(NAME_TWO);
        
         MBeanServer server = getServer();
         test1 = (Simple) server.getAttribute(NAME_ONE, "Instance");
         assertEquals("()", test1.constructorUsed);
         assertEquals(1, test1.createOrder);
         assertEquals(2, test1.startOrder);
         assertEquals(0, test1.stopOrder);
         assertEquals(0, test1.destroyOrder);

         List<ObjectName> mbeans2 = deploy(resourceName2);
         try
         {
            assertServiceRunning(NAME_ONE);
            assertServiceRunning(NAME_TWO);
           
            assertEquals(1, test1.createOrder);
            assertEquals(2, test1.startOrder);
            assertEquals(0, test1.stopOrder);
            assertEquals(0, test1.destroyOrder);
            test2 = (Simple) server.getAttribute(NAME_TWO, "Instance");
            assertEquals("()", test2.constructorUsed);
            assertEquals(3, test2.createOrder);
            assertEquals(4, test2.startOrder);
            assertEquals(0, test2.stopOrder);
            assertEquals(0, test2.destroyOrder);
View Full Code Here


      List<ObjectName> mbeans2 = deploy(resourceName2);
      try
      {
         assertServiceConfigured(NAME_TWO);
        
         MBeanServer server = getServer();
         test2 = (Simple) server.getAttribute(NAME_TWO, "Instance");
         assertEquals("()", test2.constructorUsed);
         assertEquals(0, test2.createOrder);
         assertEquals(0, test2.startOrder);
         assertEquals(0, test2.stopOrder);
         assertEquals(0, test2.destroyOrder);

         List<ObjectName> mbeans1 = deploy(resourceName1);
         try
         {
            assertServiceRunning(NAME_TWO);
            assertServiceRunning(NAME_ONE);
           
            assertEquals(2, test2.createOrder);
            assertEquals(4, test2.startOrder);
            assertEquals(0, test2.stopOrder);
            assertEquals(0, test2.destroyOrder);
            test1 = (Simple) server.getAttribute(NAME_ONE, "Instance");
            assertEquals("()", test1.constructorUsed);
            assertEquals(1, test1.createOrder);
            assertEquals(3, test1.startOrder);
            assertEquals(0, test1.stopOrder);
            assertEquals(0, test1.destroyOrder);
View Full Code Here

         try
         {
            assertServiceRunning(NAME_ONE);
            assertServiceRunning(NAME_TWO);
           
            MBeanServer server = getServer();
            test1 = (Simple) server.getAttribute(NAME_ONE, "Instance");
            assertEquals("()", test1.constructorUsed);
            assertEquals(1, test1.createOrder);
            assertEquals(2, test1.startOrder);
            assertEquals(0, test1.stopOrder);
            assertEquals(0, test1.destroyOrder);
            test2 = (Simple) server.getAttribute(NAME_TWO, "Instance");
            assertEquals("()", test2.constructorUsed);
            assertEquals(3, test2.createOrder);
            assertEquals(4, test2.startOrder);
            assertEquals(0, test2.stopOrder);
            assertEquals(0, test2.destroyOrder);
           
            undeploy(mbeans1);

            assertNotRegistered(NAME_ONE);
            assertServiceDestroyed(NAME_TWO);
           
            assertEquals(1, test1.createOrder);
            assertEquals(2, test1.startOrder);
            assertEquals(6, test1.stopOrder);
            assertEquals(8, test1.destroyOrder);
            assertEquals(3, test2.createOrder);
            assertEquals(4, test2.startOrder);
            assertEquals(5, test2.stopOrder);
            assertEquals(7, test2.destroyOrder);
           
            mbeans1 = deploy(resourceName1);

            assertServiceRunning(NAME_ONE);
            assertServiceRunning(NAME_TWO);
           
            test1 = (Simple) server.getAttribute(NAME_ONE, "Instance");
            assertEquals("()", test1.constructorUsed);
            assertEquals(9, test1.createOrder);
            assertEquals(11, test1.startOrder);
            assertEquals(0, test1.stopOrder);
            assertEquals(0, test1.destroyOrder);
View Full Code Here

         try
         {
            assertServiceRunning(NAME_ONE);
            assertServiceRunning(NAME_TWO);
           
            MBeanServer server = getServer();
            test1 = (Simple) server.getAttribute(NAME_ONE, "Instance");
            assertEquals("()", test1.constructorUsed);
            assertEquals(1, test1.createOrder);
            assertEquals(2, test1.startOrder);
            assertEquals(0, test1.stopOrder);
            assertEquals(0, test1.destroyOrder);
            test2 = (Simple) server.getAttribute(NAME_TWO, "Instance");
            assertEquals("()", test2.constructorUsed);
            assertEquals(3, test2.createOrder);
            assertEquals(4, test2.startOrder);
            assertEquals(0, test2.stopOrder);
            assertEquals(0, test2.destroyOrder);
           
            undeploy(mbeans2);

            assertServiceRunning(NAME_ONE);
            assertNoService(NAME_TWO);
           
            assertEquals(1, test1.createOrder);
            assertEquals(2, test1.startOrder);
            assertEquals(0, test1.stopOrder);
            assertEquals(0, test1.destroyOrder);
            assertEquals(3, test2.createOrder);
            assertEquals(4, test2.startOrder);
            assertEquals(5, test2.stopOrder);
            assertEquals(6, test2.destroyOrder);
           
            mbeans2 = deploy(resourceName2);

            assertServiceRunning(NAME_ONE);
            assertServiceRunning(NAME_TWO);
           
            assertEquals(1, test1.createOrder);
            assertEquals(2, test1.startOrder);
            assertEquals(0, test1.stopOrder);
            assertEquals(0, test1.destroyOrder);
            test2 = (Simple) server.getAttribute(NAME_TWO, "Instance");
            assertEquals("()", test1.constructorUsed);
            assertEquals(7, test2.createOrder);
            assertEquals(8, test2.startOrder);
            assertEquals(0, test2.stopOrder);
            assertEquals(0, test2.destroyOrder);
View Full Code Here

   public void mbeanRegistered(ObjectName objectName) throws Exception
   {
      if (objectName.equals(sampleServiceObjectName))
      {
         String value = getServiceBindingManager().getStringBinding(objectName.getCanonicalName(), null, "socket://${host}:${port}", "localhost", 9999);
         MBeanServer server = getServer();
         server.setAttribute(objectName, new Attribute("TestAttribute", value));
      }
   }
View Full Code Here

      throws ServletException
   {
      if( namingProxy != null )
         return;

      MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
      try
      {
         namingProxy = mbeanServer.getAttribute(namingProxyMBean, proxyAttribute);
      }
      catch(Exception e)
      {
         String msg = "Failed to obtain proxy from: "+namingProxyMBean
            + " via attribute:" + proxyAttribute;
View Full Code Here

         readOnlyContext = filterConfig.getInitParameter("readOnlyContext");
         String invokerName = filterConfig.getInitParameter("invokerName");
         try
         {
            // Get the Naming interface method map from the invoker
            MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
            ObjectName mbean = new ObjectName(invokerName);
            namingMethodMap = (Map) mbeanServer.getAttribute(mbean, "MethodMap");
         }
         catch(Exception e)
         {
            log.error("Failed to init ReadOnlyAccessFilter", e);
            throw new ServletException("Failed to init ReadOnlyAccessFilter", e);
View Full Code Here

    * @throws Exception
    */
   public static MBeanServer resetToJBossServer(MBeanServer server)
      throws Exception
   {
      MBeanServer coreServer = server;
      if( theDelegate != null )
      {
         Class[] sig = {String.class, MBeanServer.class, MBeanServerDelegate.class};
         Object[] args = {defaultDomain, registeredServer, theDelegate};
         ClassLoader loader = Thread.currentThread().getContextClassLoader();
View Full Code Here

    * @param server - the ServerImple MBeanServer
    * @return either the argument, or the last LazyMBeanServer created
    */
   public static MBeanServer getRegisteredMBeanServer(MBeanServer server)
   {
      MBeanServer outerServer = server;
      if( registeredServer != null )
         outerServer = registeredServer;
      return outerServer;
   }
View Full Code Here

    try {
      Hashtable<String, String> tb = new Hashtable<String, String>();
      tb.put("type", "statistics");
      tb.put("sessionFactory", "HibernateStatistics");
      ObjectName on = new ObjectName("org.olat.core.persistance", tb);
      MBeanServer server = (MBeanServer) CoreSpringFactory.getBean(MBeanServerFactoryBean.class);
      StatisticsService stats = new StatisticsService();
      stats.setSessionFactory(mySessionFactory);
      server.registerMBean(stats, on);
    } catch (MalformedObjectNameException e) {
        logWarn("JMX-Error : Can not register as MBean, MalformedObjectNameException=", e);
    } catch (InstanceAlreadyExistsException e) {
        logWarn("JMX-Error : Can not register as MBean, InstanceAlreadyExistsException=", e);
    } catch (MBeanRegistrationException e) {
View Full Code Here

TOP

Related Classes of javax.management.MBeanServer

Copyright © 2018 www.massapicom. 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.