Package javax.management

Examples of javax.management.ObjectName$WeakObjectNameCache$WeakValue


        for (Iterator it = poolNames.iterator(); it.hasNext();) {

            ThreadPoolObjectName threadPoolObjectName = (ThreadPoolObjectName) it.next();
            boolean remoteAddrAvailable = true;
            try {
                ObjectName poolName = threadPoolObjectName.getThreadPoolName();

                Connector connector = new Connector();
                connector.setName(poolName.getKeyProperty("name"));

                ObjectName grpName = threadPoolObjectName.getGlobalRequestProcessorName();

                connector.setMaxTime(JmxTools.getLongAttr(server, grpName, "maxTime"));
                connector.setProcessingTime(JmxTools.getLongAttr(server, grpName, "processingTime"));
                connector.setBytesReceived(JmxTools.getLongAttr(server, grpName, "bytesReceived"));
                connector.setBytesSent(JmxTools.getLongAttr(server, grpName, "bytesSent"));
                connector.setRequestCount(JmxTools.getIntAttr(server, grpName, "requestCount"));
                connector.setErrorCount(JmxTools.getIntAttr(server, grpName, "errorCount"));

                if (includeRequestProcessors) {
                    for (Iterator wrkIt = threadPoolObjectName.getRequestProcessorNames().iterator(); wrkIt.hasNext();) {
                        ObjectName wrkName = (ObjectName) wrkIt.next();

                        try {
                            RequestProcessor rp = new RequestProcessor();
                            rp.setName(wrkName.getKeyProperty("name"));
                            rp.setStage(JmxTools.getIntAttr(server, wrkName, "stage"));
                            rp.setProcessingTime(JmxTools.getLongAttr(server, wrkName, "requestProcessingTime"));
                            rp.setBytesSent(JmxTools.getLongAttr(server, wrkName, "requestBytesSent"));
                            rp.setBytesReceived(JmxTools.getLongAttr(server, wrkName, "requestBytesReceived"));
                            try {
View Full Code Here


        List resources = new ArrayList();

        MBeanServer server = getMBeanServer();
        if (server != null) {
            try {
                Set dsNames = server.queryNames(new ObjectName("Catalina:type=Resource,resourcetype=Global,*"), null);
                for (Iterator it = dsNames.iterator(); it.hasNext();) {
                    ObjectName objectName = (ObjectName) it.next();
                    ApplicationResource resource = new ApplicationResource();

                    logger.info("reading resource: " + objectName);
                    resource.setName(getStringAttribute(server, objectName, "name"));
                    resource.setType(getStringAttribute(server, objectName, "type"));
View Full Code Here

    public RuntimeInformation getRuntimeInformation() throws Exception {
        MBeanServer mBeanServer = new Registry().getMBeanServer();
        RuntimeInformation ri = new RuntimeInformation();

        try {
            ObjectName runtimeOName = new ObjectName("java.lang:type=Runtime");
            ri.setStartTime(JmxTools.getLongAttr(mBeanServer, runtimeOName, "StartTime"));
            ri.setUptime(JmxTools.getLongAttr(mBeanServer, runtimeOName, "Uptime"));
            ri.setVmVendor(JmxTools.getStringAttr(mBeanServer,runtimeOName,"VmVendor"));

            ObjectName osOName = new ObjectName("java.lang:type=OperatingSystem");
            ri.setOsName(JmxTools.getStringAttr(mBeanServer, osOName, "Name"));
            ri.setOsVersion(JmxTools.getStringAttr(mBeanServer, osOName, "Version"));

            if(!ri.getVmVendor().startsWith("IBM Corporation")){
                ri.setTotalPhysicalMemorySize(JmxTools.getLongAttr(mBeanServer, osOName, "TotalPhysicalMemorySize"));
View Full Code Here

  }

  public void registerMBean(Object bean, String fullName) throws Exception {
    if (mxserver == null)
      return;
    ObjectName objName = ObjectName.getInstance(fullName);
    mxserver.registerMBean(bean, objName);
    registerOSGi(bean, objName);
  }
View Full Code Here

  }

  public void unregisterMBean(String fullName) throws Exception {
    if (mxserver == null)
      return;
    ObjectName objName = ObjectName.getInstance(fullName);
    mxserver.unregisterMBean(objName);

    if (registerAsService) {
      ServiceRegistration registration = (ServiceRegistration) registeredServices.remove(objName);
      if (registration != null) {
View Full Code Here

  public Object getAttribute(String objectName, String attribute) throws Exception {
    if (mxserver == null) {
      return null;
    }
    return mxserver.getAttribute(new ObjectName(objectName), attribute);
  }
View Full Code Here

 
  public List getAttributeNames(String objectName) throws Exception {
    if (mxserver == null) {
      return null;
    }
    MBeanAttributeInfo[] attrs = mxserver.getMBeanInfo(new ObjectName(objectName)).getAttributes();
    List names = new ArrayList();
    for (int i = 0; i < attrs.length; i++) {
      names.add(attrs[i].getName());
    }
    return names;
View Full Code Here

 
  public Set queryNames(String objectName) throws MalformedObjectNameException {
    if (mxserver == null) {
      return null;
    }
    Set objectNames = mxserver.queryNames(new ObjectName(objectName), null);
    Set names = new HashSet();
    for (Iterator iterator = objectNames.iterator(); iterator.hasNext();) {
      ObjectName objName = (ObjectName) iterator.next();
      names.add(objName.getCanonicalName());
    }
    return names;
  }
View Full Code Here

    public List getPools() throws Exception {

        List memoryPools = new LinkedList();
        MBeanServer mBeanServer = new Registry().getMBeanServer();
        Set memoryOPools = mBeanServer.queryMBeans(new ObjectName("java.lang:type=MemoryPool,*"), null);

        //
        // totals
        //
        long totalInit = 0;
        long totalMax = 0;
        long totalUsed = 0;
        long totalCommitted = 0;

        for (Iterator it = memoryOPools.iterator(); it.hasNext();) {
            ObjectInstance oi = (ObjectInstance) it.next();
            ObjectName oName = oi.getObjectName();
            MemoryPool memoryPool = new MemoryPool();
            memoryPool.setName(JmxTools.getStringAttr(mBeanServer, oName, "Name"));
            memoryPool.setType(JmxTools.getStringAttr(mBeanServer, oName, "Type"));

            CompositeDataSupport cd = (CompositeDataSupport) mBeanServer.getAttribute(oName, "Usage");
            //
            // It seems that "Usage" attribute of one of the pools may turn into null intermittently. We better have a
            // dip in the graph then an NPE though.
            //
            if (cd != null) {
                memoryPool.setMax(JmxTools.getLongAttr(cd, "max"));
                memoryPool.setUsed(JmxTools.getLongAttr(cd, "used"));
                memoryPool.setInit(JmxTools.getLongAttr(cd, "init"));
                memoryPool.setCommitted(JmxTools.getLongAttr(cd, "committed"));
            } else {
                logger.error("Oops, JVM problem? "+oName.toString()+" \"Usage\" attribute is NULL!");
            }

            totalInit += memoryPool.getInit();
            totalMax += memoryPool.getMax();
            totalUsed += memoryPool.getUsed();
View Full Code Here

      assertTrue("Should be registered", mBeanServer.isRegistered(mBeanName));
   }

   public void testSetCacheObjectName() throws Exception
   {
      ObjectName on = new ObjectName("jboss.cache:test=SetCacheObjectName");
      boolean registered = false;
      try
      {
         CacheJmxWrapper<String, String> wrapper = createWrapper(createConfiguration());
         wrapper.setCacheObjectName(on.getCanonicalName());

         // Register under the standard name
         registerWrapper(wrapper);
         // Should be registered under 'on'
         registered = mBeanServer.isRegistered(on);

         assertTrue("Registered with configured name", registered);
         assertEquals("Configured name retained", on.getCanonicalName(), wrapper.getCacheObjectName());

         wrapper.create();
         wrapper.start();

         interceptorRegistrationTest(on.getCanonicalName(), true);

         wrapper.stop();
         wrapper.destroy();

         interceptorRegistrationTest(false);
View Full Code Here

TOP

Related Classes of javax.management.ObjectName$WeakObjectNameCache$WeakValue

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.