Package javax.management

Examples of javax.management.ObjectName$WeakObjectNameCache


import junit.framework.TestCase;

public class JMXUtilsTest extends TestCase {
    static final String OBJECT_NAME = "org.objectweb.celtix.instrumentation:type=foo,Bus=celtix,name=boo";
    public void testGetObjectName() {
        ObjectName name = JMXUtils.getObjectName("foo", ",name=boo", "celtix");       
        assertTrue("The wrong object name", OBJECT_NAME.compareTo(name.toString()) == 0);
    }
View Full Code Here


    }

    protected void onSetUp() throws Exception {
       
        try {
            ton = new ObjectName("org.objectweb.celtix:Type=testInstrumentation");
        } catch (MalformedObjectNameException e) {           
            e.printStackTrace();
        } catch (NullPointerException e) {           
            e.printStackTrace();
        }
View Full Code Here

      MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
      // Unique identification of MBeans
      Statistics statBean = Statistics.getStatistics();
      // Uniquely identify the MBeans and register them with the platform
      // MBeanServer
      ObjectName statName = new ObjectName("marauroad:name=Statistics");
      mbs.registerMBean(statBean, statName);
      logger.debug("Statistics bean registered.");
    } catch (Exception e) {
      logger.error("cannot register statistics bean, continuing anyway.", e);
    }
View Full Code Here

     * @param object
     *            {@link Object}
     * @return {@link ObjectName} instance
     */
    public ObjectName createObjectName(Object object) {
        ObjectName objectName = null;
        try {
            objectName = new ObjectName(object.getClass().toString() + ":type=Manager,name="
                    + object.getClass().getName());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return objectName;
View Full Code Here

     
      //Need to pause a little while - cancelling back to the queue is async
     
      Thread.sleep(500);

      ObjectName on = new ObjectName("jboss.messaging.destination:service=Queue,name=Queue");
      Integer i = (Integer)ServerManagement.getAttribute(on, "MessageCount");

      assertEquals(1, i.intValue());
   }
View Full Code Here

      cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");

      queue = (Queue)ic.lookup("/queue/HTTPTestQueue");

      queueObjectName =
         new ObjectName("jboss.messaging.destination:service=Queue,name=HTTPTestQueue");

      ServerManagement.invoke(queueObjectName, "removeAllMessages", new Object[0], new String[0]);

      log.debug("setup done");
   }
View Full Code Here

         "       <attribute name=\"Clustered\">" + String.valueOf(clustered) + "</attribute>" +
         "</mbean>";

      MBeanConfigurationElement mbean =
         new MBeanConfigurationElement(XMLUtil.stringToElement(config));
      ObjectName deston = sc.registerAndConfigureService(mbean);
      sc.invoke(deston, "create", new Object[0], new String[0]);
      sc.invoke(deston, "start", new Object[0], new String[0]);
   }
View Full Code Here

         "    <attribute name=\"Clustered\">" + String.valueOf(clustered) + "</attribute>" +
         "</mbean>";

      MBeanConfigurationElement mbean =
         new MBeanConfigurationElement(XMLUtil.stringToElement(config));
      ObjectName deston = sc.registerAndConfigureService(mbean);
      sc.invoke(deston, "create", new Object[0], new String[0]);
      sc.invoke(deston, "start", new Object[0], new String[0]);
   }
View Full Code Here

      sc.invoke(deston, "start", new Object[0], new String[0]);
   }

   public void undeployDestination(boolean isQueue, String name) throws Exception
   {
      ObjectName pattern =
         new ObjectName("*:service=" + (isQueue ? "Queue" : "Topic") + ",name=" + name);
      Set s = sc.query(pattern);
      int size = s.size();
      if (size == 0)
      {
         log.debug("No such " + (isQueue ? "queue" : "topic") + " to undeploy: " + name);
         return;
      }
      if (size > 1)
      {
         throw new Exception("Too many destination with the same name: " + name);
      }
      ObjectName destinationObjectName = (ObjectName)s.iterator().next();
      sc.invoke(destinationObjectName, "stop", new Object[0], new String[0]);
      sc.invoke(destinationObjectName, "destroy", new Object[0], new String[0]);
      sc.unregisterService(destinationObjectName);
   }
View Full Code Here

         config += "<binding>" + jndiBindings[i] + "</binding>\n";
      }
      config += "</bindings></attribute></mbean>";

      MBeanConfigurationElement mc = new MBeanConfigurationElement(XMLUtil.stringToElement(config));
      ObjectName on = sc.registerAndConfigureService(mc);
     
      log.trace("Object name is now: " + on);
     
      sc.invoke(on, "create", new Object[0], new String[0]);
      sc.invoke(on, "start", new Object[0], new String[0]);
View Full Code Here

TOP

Related Classes of javax.management.ObjectName$WeakObjectNameCache

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.