Package javax.management

Examples of javax.management.MBeanServer


   {
      if(isBeforeFlush)
        log.trace("Before flush of authentication cache::");
      else
         log.trace("After flush of authentication cache::");
      MBeanServer server = MBeanServerLocator.locateJBoss();
     
      List list = (List)server.invoke(on,"getAuthenticationCachePrincipals",
            new Object[]{securityDomain}, new String[] {"java.lang.String"} );
     
      int len = list != null ? list.size() : 0;
      log.trace("Number of authenticated principals remaining in cache=" + len);
      for(int i = 0 ; i < len; i++)
View Full Code Here


         Throwable t = JMXExceptionDecoder.decode(e);
         log.error("Failed to unregister mbeans", t);
      }
      try
      {
         MBeanServer registeredServer = mbeanServer;
         if (serverConfig.isUsePlatformMBeanServer() == true)
            registeredServer = LazyMBeanServer.getRegisteredMBeanServer(mbeanServer);
         MBeanServerFactory.releaseMBeanServer(registeredServer);
      }
      catch (Exception e)
View Full Code Here

      List<ObjectName> mbeans = deploy("BasicLifecycle_NotAutomatic.xml");
      try
      {
         assertServiceRunning(name);
        
         MBeanServer server = getServer();
         test = (Simple) server.getAttribute(name, "Instance");
         assertEquals("()", test.constructorUsed);
         assertEquals(1, test.createOrder);
         assertEquals(2, test.startOrder);
         assertEquals(0, test.stopOrder);
         assertEquals(0, test.destroyOrder);
View Full Code Here

      List<ObjectName> mbeans = deploy("BasicLifecycle_NotAutomatic.xml");
      try
      {
         assertServiceRunning(name);
        
         MBeanServer server = getServer();
         test = (Simple) server.getAttribute(name, "Instance");
         assertEquals("()", test.constructorUsed);
         assertEquals(1, test.createOrder);
         assertEquals(2, test.startOrder);
         assertEquals(0, test.stopOrder);
         assertEquals(0, test.destroyOrder);
      }
      catch (Exception e)
      {
         error = true;
         throw e;
      }
      finally
      {
         undeploy(mbeans);

         if (error == false)
         {
            assertNoService(name);
            assertNotRegistered(name);
           
            assertEquals(1, test.createOrder);
            assertEquals(2, test.startOrder);
            assertEquals(3, test.stopOrder);
            assertEquals(4, test.destroyOrder);
         }
      }
     
      mbeans = deploy("BasicLifecycle_NotAutomatic.xml");
      try
      {
         assertServiceRunning(name);
        
         MBeanServer server = getServer();
         test = (Simple) server.getAttribute(name, "Instance");
         assertEquals("()", test.constructorUsed);
         assertEquals(5, test.createOrder);
         assertEquals(6, test.startOrder);
         assertEquals(0, test.stopOrder);
         assertEquals(0, test.destroyOrder);
View Full Code Here

      List<ObjectName> mbeans = deploy("BasicLifecycle_NotAutomatic.xml");
      try
      {
         assertServiceRunning(name);

         MBeanServer server = getServer();
         test = (Simple) server.getAttribute(name, "Instance");
         assertEquals("()", test.constructorUsed);
         assertEquals(1, test.createOrder);
         assertEquals(2, test.startOrder);
         assertEquals(0, test.stopOrder);
         assertEquals(0, test.destroyOrder);
View Full Code Here

   public void testServiceDeployerComponentName() throws Exception
   {
      SecurityManager sm = suspendSecurity();
      try
      {
         MBeanServer mbeanServer = createMBeanServer("jboss");
         try
         {
            ServiceController serviceController = new ServiceController();
            ObjectName objectName = new ObjectName("jboss.system:service=ServiceController");
            mbeanServer.registerMBean(serviceController, objectName);
            try
            {
               ClassLoader loader = Thread.currentThread().getContextClassLoader();
               mbeanServer.registerMBean(new JmxCL(loader), new ObjectName("jboss:service=defaultClassLoader"));

               BasicBootstrap bootstrap = new BasicBootstrap();
               bootstrap.run();
               Kernel kernel = bootstrap.getKernel();
               AbstractController controller = (AbstractController)kernel.getController();

               serviceController.setMBeanServer(mbeanServer);
               serviceController.setKernel(kernel);

               MainDeployerImpl mainDeployer = new MainDeployerImpl();
               mainDeployer.setStructuralDeployers(new StructuralDeployers()
               {
                  public DeploymentContext determineStructure(Deployment deployment) throws DeploymentException
                  {
                     return new AbstractDeploymentContext("SMD", "");
                  }
               });
               DeployersImpl deployersImpl = new DeployersImpl(controller);
               deployersImpl.addDeployer(new ServiceDeployer(serviceController));
               deployersImpl.addDeployer(new ServiceDeploymentDeployer());
               deployersImpl.addDeployer(new CLDeployer());
               deployersImpl.addDeployer(new SMDParsingDeployer());
               mainDeployer.setDeployers(deployersImpl);

               Deployment deployment = new AbstractDeployment("SMD");
               mainDeployer.addDeployment(deployment);
               mainDeployer.process();

               mainDeployer.checkComplete(deployment);
               fail("Should not be here");
            }
            catch (Exception e)
            {
               assertInstanceOf(e, IncompleteDeploymentException.class);              
            }
            finally
            {
               mbeanServer.unregisterMBean(objectName);
            }
         }
         finally
         {
            MBeanServerFactory.releaseMBeanServer(mbeanServer);
View Full Code Here

      }
   }

   private MBeanServer createMBeanServer(String domain) throws Exception
   {
      MBeanServer server;

      String builder = System.getProperty(ServerConstants.MBEAN_SERVER_BUILDER_CLASS_PROPERTY, ServerConstants.DEFAULT_MBEAN_SERVER_BUILDER_CLASS);
      System.setProperty(ServerConstants.MBEAN_SERVER_BUILDER_CLASS_PROPERTY, builder);

      ClassLoader cl = Thread.currentThread().getContextClassLoader();
View Full Code Here

      {
         if (realCm == null)
         {
            try
            {
               MBeanServer server = MBeanServerLocator.locateJBoss();
               realCm = (BaseConnectionManager2) server.getAttribute(cmName, "Instance");
            }
            catch (Throwable t)
            {
               Throwable t2 = JMXExceptionDecoder.decode(t);
               JBossResourceException.rethrowAsResourceException("Problem locating real ConnectionManager: " + cmName,
View Full Code Here

         super(clazz);
      }

      protected MBeanServer createMBeanServer()
      {
         MBeanServer result = MBeanServerFactory.createMBeanServer("jboss");
         MBeanServerLocator.setJBoss(result);
         return result;
      }
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(2, test1.createOrder);
         assertEquals(4, test1.startOrder);
         assertEquals(0, test1.stopOrder);
         assertEquals(0, test1.destroyOrder);
         test2 = (Simple) server.getAttribute(NAME_TWO, "Instance");
         assertEquals("()", test2.constructorUsed);
         assertEquals(1, test2.createOrder);
         assertEquals(3, test2.startOrder);
         assertEquals(0, test2.stopOrder);
         assertEquals(0, test2.destroyOrder);
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.