Package javax.management

Examples of javax.management.ObjectName$Property


     */
    private synchronized void initialize() throws Exception {

        MBeanServer server = getContainerWrapper().getResourceResolver().getMBeanServer();
        String serverName = getContainerWrapper().getTomcatContainer().getName();
        Set threadPools = server.queryMBeans(new ObjectName(serverName + ":type=ThreadPool,*"), null);
        poolNames = new ArrayList(threadPools.size());
        for (Iterator it = threadPools.iterator(); it.hasNext();) {

            ThreadPoolObjectName threadPoolObjectName = new ThreadPoolObjectName();
            ObjectName threadPoolName = ((ObjectInstance) it.next()).getObjectName();

            String name = threadPoolName.getKeyProperty("name");

            threadPoolObjectName.setThreadPoolName(threadPoolName);
            ObjectName grpName = server.getObjectInstance(
                    new ObjectName(threadPoolName.getDomain() + ":type=GlobalRequestProcessor,name=" + name)).getObjectName();
            threadPoolObjectName.setGlobalRequestProcessorName(grpName);

            //
            // unfortunately exact workers could not be found at the time of testing
            // so we filter out the relevant workers within the loop
            //
            Set workers = server.queryMBeans(new ObjectName(threadPoolName.getDomain() + ":type=RequestProcessor,*"), null);

            for (Iterator wrkIt = workers.iterator(); wrkIt.hasNext();) {
                ObjectName wrkName = ((ObjectInstance) wrkIt.next()).getObjectName();
                if (name.equals(wrkName.getKeyProperty("worker"))) {
                    threadPoolObjectName.getRequestProcessorNames().add(wrkName);
                }
            }

            poolNames.add(threadPoolObjectName);
        }

        Set executors = server.queryMBeans(new ObjectName(serverName + ":type=Executor,*"), null);
        executorNames = new ArrayList(executors.size());
        for (Iterator it = executors.iterator(); it.hasNext();) {
            ObjectName executorName = ((ObjectInstance) it.next()).getObjectName();
            executorNames.add(executorName);
        }

        // Register with MBean server
        server.addNotificationListener(new ObjectName("JMImplementation:type=MBeanServerDelegate"), this, null, null);

    }
View Full Code Here


        List threadPools = new ArrayList(poolNames.size());

        MBeanServer server = getContainerWrapper().getResourceResolver().getMBeanServer();

        for (Iterator it = executorNames.iterator(); it.hasNext();) {
            ObjectName executorName = (ObjectName) it.next();

            ThreadPool threadPool = new ThreadPool();
            threadPool.setName(executorName.getKeyProperty("name"));
            threadPool.setMaxThreads(JmxTools.getIntAttr(server, executorName, "maxThreads"));
            threadPool.setMaxSpareThreads(JmxTools.getIntAttr(server, executorName, "largestPoolSize"));
            threadPool.setMinSpareThreads(JmxTools.getIntAttr(server, executorName, "minSpareThreads"));
            threadPool.setCurrentThreadsBusy(JmxTools.getIntAttr(server, executorName, "activeCount"));
            threadPool.setCurrentThreadCount(JmxTools.getIntAttr(server, executorName, "poolSize"));

            threadPools.add(threadPool);
        }

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

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

                ThreadPool threadPool = new ThreadPool();
                threadPool.setName(poolName.getKeyProperty("name"));
                threadPool.setMaxThreads(JmxTools.getIntAttr(server, poolName, "maxThreads"));

                if (JmxTools.hasAttribute(server, poolName, "maxSpareThreads")) {
                    threadPool.setMaxSpareThreads(JmxTools.getIntAttr(server, poolName, "maxSpareThreads"));
                    threadPool.setMinSpareThreads(JmxTools.getIntAttr(server, poolName, "minSpareThreads"));
View Full Code Here

        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

TOP

Related Classes of javax.management.ObjectName$Property

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.