Package javax.management

Examples of javax.management.ObjectName$WeakObjectNameCache


    }

    public static boolean isThreadingEnabled() {
        try {
            MBeanServer mBeanServer = new Registry().getMBeanServer();
            ObjectName threadingOName = new ObjectName("java.lang:type=Threading");
            Set s = mBeanServer.queryMBeans(threadingOName, null);
            return s != null && s.size() > 0;
        } catch (MalformedObjectNameException e) {
            return false;
        }
View Full Code Here


        List threads = null;
        int executionStackDepth = 1;

        MBeanServer mBeanServer = new Registry().getMBeanServer();
        ObjectName threadingOName = new ObjectName("java.lang:type=Threading");

        long[] deadlockedIds = (long[]) mBeanServer.invoke(threadingOName, "findMonitorDeadlockedThreads", null, null);
        long[] allIds = (long[]) mBeanServer.getAttribute(threadingOName, "AllThreadIds");

        if (allIds != null) {
View Full Code Here

    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

  private int getConnectorPort(final String protocol, final boolean secure) {
    int port = -1;

    try {
      ObjectName connectors = new ObjectName("jboss.web:type=Connector,*");

      Set<?> connectorNames = getMbeanServer().queryNames(connectors, null);
      for (Object current : connectorNames) {
        ObjectName currentName = (ObjectName) current;

        try {
          int connectorPort = (Integer) getMbeanServer()
              .getAttribute(currentName, "port");
          boolean connectorSecure = (Boolean) getMbeanServer()
View Full Code Here

    public void setWrapper(Wrapper wrapper) {
        if (wrapper != null) {
            host = (Host) wrapper.getParent().getParent();
            try {
                deployerOName = new ObjectName(host.getParent().getName() + ":type=Deployer,host=" + host.getName());
            } catch (MalformedObjectNameException e) {
                // do nothing here
            }
            host.getPipeline().addValve(valve);
            mBeanServer = Registry.getRegistry(null, null).getMBeanServer();
View Full Code Here

    public void setWrapper(Wrapper wrapper) {
        if (wrapper != null) {
            host = (Host) wrapper.getParent().getParent();
            try {
                deployerOName = new ObjectName(host.getParent().getName() + ":type=Deployer,host=" + host.getName());
            } catch (MalformedObjectNameException e) {
                // do nothing here
            }
            host.getPipeline().addValve(valve);
            mBeanServer = Registry.getRegistry(null, null).getMBeanServer();
View Full Code Here

    public void test() throws Exception {
        HashMap<String, MBeanAttributeInfo> attrMap;
        HashMap<String, MBeanOperationInfo> opMap;
        String result;
        MBeanInfo info;
        ObjectName name;
        Connection conn;
        Statement stat;

        MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();

        conn = getConnection("mem:jmx;jmx=true");
        stat = conn.createStatement();

        name = new ObjectName("org.h2:name=JMX,path=mem_jmx");
        info = mbeanServer.getMBeanInfo(name);
        assertEquals("0", mbeanServer.getAttribute(name, "CacheSizeMax").toString());
        // cache size is ignored for in-memory databases
        mbeanServer.setAttribute(name, new Attribute("CacheSizeMax", 1));
        assertEquals("0", mbeanServer.getAttribute(name, "CacheSizeMax").toString());
        assertEquals("0", mbeanServer.getAttribute(name, "CacheSize").toString());
        assertEquals("false", mbeanServer.getAttribute(name, "Exclusive").toString());
        assertEquals("0", mbeanServer.getAttribute(name, "FileSize").toString());
        assertEquals("0", mbeanServer.getAttribute(name, "FileReadCount").toString());
        assertEquals("0", mbeanServer.getAttribute(name, "FileWriteCount").toString());
        assertEquals("0", mbeanServer.getAttribute(name, "FileWriteCountTotal").toString());
        assertEquals("0", mbeanServer.getAttribute(name, "LogMode").toString());
        // ignored for in-memory databases
        mbeanServer.setAttribute(name, new Attribute("LogMode", 1));
        assertEquals("0", mbeanServer.getAttribute(name, "LogMode").toString());
        assertEquals("REGULAR", mbeanServer.getAttribute(name, "Mode").toString());
        assertEquals("false", mbeanServer.getAttribute(name, "MultiThreaded").toString());
        assertEquals("false", mbeanServer.getAttribute(name, "Mvcc").toString());
        assertEquals("false", mbeanServer.getAttribute(name, "ReadOnly").toString());
        assertEquals("1", mbeanServer.getAttribute(name, "TraceLevel").toString());
        mbeanServer.setAttribute(name, new Attribute("TraceLevel", 0));
        assertEquals("0", mbeanServer.getAttribute(name, "TraceLevel").toString());
        assertTrue(mbeanServer.getAttribute(name, "Version").toString().startsWith("1."));
        assertEquals(14, info.getAttributes().length);
        result = mbeanServer.invoke(name, "listSettings", null, null).toString();
        assertTrue(result.indexOf("ANALYZE_AUTO") >= 0);

        conn.setAutoCommit(false);
        stat.execute("create table test(id int)");
        stat.execute("insert into test values(1)");

        result = mbeanServer.invoke(name, "listSessions", null, null).toString();
        assertTrue(result.indexOf("session id") >= 0);
        assertTrue(result.indexOf("write lock") >= 0);

        assertEquals(2, info.getOperations().length);
        assertTrue(info.getDescription().indexOf("database") >= 0);
        attrMap = New.hashMap();
        for (MBeanAttributeInfo a : info.getAttributes()) {
            attrMap.put(a.getName(), a);
        }
        assertTrue(attrMap.get("CacheSize").getDescription().indexOf("KB") >= 0);
        opMap = New.hashMap();
        for (MBeanOperationInfo o : info.getOperations()) {
            opMap.put(o.getName(), o);
        }
        assertTrue(opMap.get("listSessions").getDescription().indexOf("lock") >= 0);
        assertEquals(MBeanOperationInfo.INFO, opMap.get("listSessions").getImpact());

        conn.close();

        conn = getConnection("jmx;jmx=true");

        name = new ObjectName("org.h2:name=JMX,*");
        Set set = mbeanServer.queryNames(name, null);
        name = (ObjectName) set.iterator().next();

        assertEquals("16384", mbeanServer.getAttribute(name, "CacheSizeMax").toString());
        mbeanServer.setAttribute(name, new Attribute("CacheSizeMax", 1));
View Full Code Here

    assertTrue(platform.isAvailable());
  }

  @Test
  public void testRegister() throws Exception {
    assertFalse(mbs.isRegistered(new ObjectName(DOZER_ADMIN_CONTROLLER)));

    platform.registerMBean(DOZER_ADMIN_CONTROLLER, new DozerAdminController());
    assertTrue(mbs.isRegistered(new ObjectName(DOZER_ADMIN_CONTROLLER)));

    platform.unregisterMBean(DOZER_ADMIN_CONTROLLER);
    assertFalse(mbs.isRegistered(new ObjectName(DOZER_ADMIN_CONTROLLER)));
  }
View Full Code Here

  }

  @After
  public void tearDown() throws Exception {
    try {
      mbs.unregisterMBean(new ObjectName(DOZER_ADMIN_CONTROLLER));
    } catch (Exception e) {
    }
  }
View Full Code Here

      return false;
    }
  }

  public void registerMBean(String name, Object bean) throws MalformedObjectNameException, MBeanRegistrationException, NotCompliantMBeanException {
    ObjectName mbeanObjectName = new ObjectName(name);
    unregister(name, mbeanObjectName);
    register(name, bean, mbeanObjectName);
  }
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.