Java Code Examples for com.sun.corba.se.spi.monitoring.MonitoringConstants#THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION

The following examples show how to use com.sun.corba.se.spi.monitoring.MonitoringConstants#THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreadPoolImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
private void initializeMonitoring() {
    // Get root monitored object
    MonitoredObject root = MonitoringFactories.getMonitoringManagerFactory().
            createMonitoringManager(MonitoringConstants.DEFAULT_MONITORING_ROOT, null).
            getRootMonitoredObject();

    // Create the threadpool monitoring root
    MonitoredObject threadPoolMonitoringObjectRoot = root.getChild(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT);
    if (threadPoolMonitoringObjectRoot == null) {
        threadPoolMonitoringObjectRoot =  MonitoringFactories.
                getMonitoredObjectFactory().createMonitoredObject(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT,
                MonitoringConstants.THREADPOOL_MONITORING_ROOT_DESCRIPTION);
        root.addChild(threadPoolMonitoringObjectRoot);
    }
    threadpoolMonitoredObject = MonitoringFactories.
                getMonitoredObjectFactory().
                createMonitoredObject(name,
                MonitoringConstants.THREADPOOL_MONITORING_DESCRIPTION);

    threadPoolMonitoringObjectRoot.addChild(threadpoolMonitoredObject);

    LongMonitoredAttributeBase b1 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentNumberOfThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b1);
    LongMonitoredAttributeBase b2 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_AVAILABLE_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfAvailableThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b2);
    LongMonitoredAttributeBase b3 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS,
                MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfBusyThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b3);
    LongMonitoredAttributeBase b4 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME,
                MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.averageWorkCompletionTime());
            }
        };
    threadpoolMonitoredObject.addAttribute(b4);
    LongMonitoredAttributeBase b5 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT,
                MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentProcessedCount());
            }
        };
    threadpoolMonitoredObject.addAttribute(b5);

    // Add the monitored object for the WorkQueue

    threadpoolMonitoredObject.addChild(
            ((WorkQueueImpl)workQueue).getMonitoredObject());
}
 
Example 2
Source File: ThreadPoolImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void initializeMonitoring() {
    // Get root monitored object
    MonitoredObject root = MonitoringFactories.getMonitoringManagerFactory().
            createMonitoringManager(MonitoringConstants.DEFAULT_MONITORING_ROOT, null).
            getRootMonitoredObject();

    // Create the threadpool monitoring root
    MonitoredObject threadPoolMonitoringObjectRoot = root.getChild(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT);
    if (threadPoolMonitoringObjectRoot == null) {
        threadPoolMonitoringObjectRoot =  MonitoringFactories.
                getMonitoredObjectFactory().createMonitoredObject(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT,
                MonitoringConstants.THREADPOOL_MONITORING_ROOT_DESCRIPTION);
        root.addChild(threadPoolMonitoringObjectRoot);
    }
    threadpoolMonitoredObject = MonitoringFactories.
                getMonitoredObjectFactory().
                createMonitoredObject(name,
                MonitoringConstants.THREADPOOL_MONITORING_DESCRIPTION);

    threadPoolMonitoringObjectRoot.addChild(threadpoolMonitoredObject);

    LongMonitoredAttributeBase b1 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentNumberOfThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b1);
    LongMonitoredAttributeBase b2 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_AVAILABLE_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfAvailableThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b2);
    LongMonitoredAttributeBase b3 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS,
                MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfBusyThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b3);
    LongMonitoredAttributeBase b4 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME,
                MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.averageWorkCompletionTime());
            }
        };
    threadpoolMonitoredObject.addAttribute(b4);
    LongMonitoredAttributeBase b5 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT,
                MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentProcessedCount());
            }
        };
    threadpoolMonitoredObject.addAttribute(b5);

    // Add the monitored object for the WorkQueue

    threadpoolMonitoredObject.addChild(
            ((WorkQueueImpl)workQueue).getMonitoredObject());
}
 
Example 3
Source File: ThreadPoolImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private void initializeMonitoring() {
    // Get root monitored object
    MonitoredObject root = MonitoringFactories.getMonitoringManagerFactory().
            createMonitoringManager(MonitoringConstants.DEFAULT_MONITORING_ROOT, null).
            getRootMonitoredObject();

    // Create the threadpool monitoring root
    MonitoredObject threadPoolMonitoringObjectRoot = root.getChild(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT);
    if (threadPoolMonitoringObjectRoot == null) {
        threadPoolMonitoringObjectRoot =  MonitoringFactories.
                getMonitoredObjectFactory().createMonitoredObject(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT,
                MonitoringConstants.THREADPOOL_MONITORING_ROOT_DESCRIPTION);
        root.addChild(threadPoolMonitoringObjectRoot);
    }
    threadpoolMonitoredObject = MonitoringFactories.
                getMonitoredObjectFactory().
                createMonitoredObject(name,
                MonitoringConstants.THREADPOOL_MONITORING_DESCRIPTION);

    threadPoolMonitoringObjectRoot.addChild(threadpoolMonitoredObject);

    LongMonitoredAttributeBase b1 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentNumberOfThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b1);
    LongMonitoredAttributeBase b2 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_AVAILABLE_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfAvailableThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b2);
    LongMonitoredAttributeBase b3 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS,
                MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfBusyThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b3);
    LongMonitoredAttributeBase b4 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME,
                MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.averageWorkCompletionTime());
            }
        };
    threadpoolMonitoredObject.addAttribute(b4);
    LongMonitoredAttributeBase b5 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT,
                MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentProcessedCount());
            }
        };
    threadpoolMonitoredObject.addAttribute(b5);

    // Add the monitored object for the WorkQueue

    threadpoolMonitoredObject.addChild(
            ((WorkQueueImpl)workQueue).getMonitoredObject());
}
 
Example 4
Source File: ThreadPoolImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
private void initializeMonitoring() {
    // Get root monitored object
    MonitoredObject root = MonitoringFactories.getMonitoringManagerFactory().
            createMonitoringManager(MonitoringConstants.DEFAULT_MONITORING_ROOT, null).
            getRootMonitoredObject();

    // Create the threadpool monitoring root
    MonitoredObject threadPoolMonitoringObjectRoot = root.getChild(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT);
    if (threadPoolMonitoringObjectRoot == null) {
        threadPoolMonitoringObjectRoot =  MonitoringFactories.
                getMonitoredObjectFactory().createMonitoredObject(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT,
                MonitoringConstants.THREADPOOL_MONITORING_ROOT_DESCRIPTION);
        root.addChild(threadPoolMonitoringObjectRoot);
    }
    threadpoolMonitoredObject = MonitoringFactories.
                getMonitoredObjectFactory().
                createMonitoredObject(name,
                MonitoringConstants.THREADPOOL_MONITORING_DESCRIPTION);

    threadPoolMonitoringObjectRoot.addChild(threadpoolMonitoredObject);

    LongMonitoredAttributeBase b1 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentNumberOfThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b1);
    LongMonitoredAttributeBase b2 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_AVAILABLE_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfAvailableThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b2);
    LongMonitoredAttributeBase b3 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS,
                MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfBusyThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b3);
    LongMonitoredAttributeBase b4 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME,
                MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.averageWorkCompletionTime());
            }
        };
    threadpoolMonitoredObject.addAttribute(b4);
    LongMonitoredAttributeBase b5 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT,
                MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentProcessedCount());
            }
        };
    threadpoolMonitoredObject.addAttribute(b5);

    // Add the monitored object for the WorkQueue

    threadpoolMonitoredObject.addChild(
            ((WorkQueueImpl)workQueue).getMonitoredObject());
}
 
Example 5
Source File: ThreadPoolImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void initializeMonitoring() {
    // Get root monitored object
    MonitoredObject root = MonitoringFactories.getMonitoringManagerFactory().
            createMonitoringManager(MonitoringConstants.DEFAULT_MONITORING_ROOT, null).
            getRootMonitoredObject();

    // Create the threadpool monitoring root
    MonitoredObject threadPoolMonitoringObjectRoot = root.getChild(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT);
    if (threadPoolMonitoringObjectRoot == null) {
        threadPoolMonitoringObjectRoot =  MonitoringFactories.
                getMonitoredObjectFactory().createMonitoredObject(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT,
                MonitoringConstants.THREADPOOL_MONITORING_ROOT_DESCRIPTION);
        root.addChild(threadPoolMonitoringObjectRoot);
    }
    threadpoolMonitoredObject = MonitoringFactories.
                getMonitoredObjectFactory().
                createMonitoredObject(name,
                MonitoringConstants.THREADPOOL_MONITORING_DESCRIPTION);

    threadPoolMonitoringObjectRoot.addChild(threadpoolMonitoredObject);

    LongMonitoredAttributeBase b1 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentNumberOfThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b1);
    LongMonitoredAttributeBase b2 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_AVAILABLE_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfAvailableThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b2);
    LongMonitoredAttributeBase b3 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS,
                MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfBusyThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b3);
    LongMonitoredAttributeBase b4 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME,
                MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.averageWorkCompletionTime());
            }
        };
    threadpoolMonitoredObject.addAttribute(b4);
    LongMonitoredAttributeBase b5 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT,
                MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentProcessedCount());
            }
        };
    threadpoolMonitoredObject.addAttribute(b5);

    // Add the monitored object for the WorkQueue

    threadpoolMonitoredObject.addChild(
            ((WorkQueueImpl)workQueue).getMonitoredObject());
}
 
Example 6
Source File: ThreadPoolImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private void initializeMonitoring() {
    // Get root monitored object
    MonitoredObject root = MonitoringFactories.getMonitoringManagerFactory().
            createMonitoringManager(MonitoringConstants.DEFAULT_MONITORING_ROOT, null).
            getRootMonitoredObject();

    // Create the threadpool monitoring root
    MonitoredObject threadPoolMonitoringObjectRoot = root.getChild(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT);
    if (threadPoolMonitoringObjectRoot == null) {
        threadPoolMonitoringObjectRoot =  MonitoringFactories.
                getMonitoredObjectFactory().createMonitoredObject(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT,
                MonitoringConstants.THREADPOOL_MONITORING_ROOT_DESCRIPTION);
        root.addChild(threadPoolMonitoringObjectRoot);
    }
    threadpoolMonitoredObject = MonitoringFactories.
                getMonitoredObjectFactory().
                createMonitoredObject(name,
                MonitoringConstants.THREADPOOL_MONITORING_DESCRIPTION);

    threadPoolMonitoringObjectRoot.addChild(threadpoolMonitoredObject);

    LongMonitoredAttributeBase b1 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentNumberOfThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b1);
    LongMonitoredAttributeBase b2 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_AVAILABLE_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfAvailableThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b2);
    LongMonitoredAttributeBase b3 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS,
                MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfBusyThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b3);
    LongMonitoredAttributeBase b4 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME,
                MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.averageWorkCompletionTime());
            }
        };
    threadpoolMonitoredObject.addAttribute(b4);
    LongMonitoredAttributeBase b5 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT,
                MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentProcessedCount());
            }
        };
    threadpoolMonitoredObject.addAttribute(b5);

    // Add the monitored object for the WorkQueue

    threadpoolMonitoredObject.addChild(
            ((WorkQueueImpl)workQueue).getMonitoredObject());
}
 
Example 7
Source File: ThreadPoolImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void initializeMonitoring() {
    // Get root monitored object
    MonitoredObject root = MonitoringFactories.getMonitoringManagerFactory().
            createMonitoringManager(MonitoringConstants.DEFAULT_MONITORING_ROOT, null).
            getRootMonitoredObject();

    // Create the threadpool monitoring root
    MonitoredObject threadPoolMonitoringObjectRoot = root.getChild(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT);
    if (threadPoolMonitoringObjectRoot == null) {
        threadPoolMonitoringObjectRoot =  MonitoringFactories.
                getMonitoredObjectFactory().createMonitoredObject(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT,
                MonitoringConstants.THREADPOOL_MONITORING_ROOT_DESCRIPTION);
        root.addChild(threadPoolMonitoringObjectRoot);
    }
    threadpoolMonitoredObject = MonitoringFactories.
                getMonitoredObjectFactory().
                createMonitoredObject(name,
                MonitoringConstants.THREADPOOL_MONITORING_DESCRIPTION);

    threadPoolMonitoringObjectRoot.addChild(threadpoolMonitoredObject);

    LongMonitoredAttributeBase b1 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentNumberOfThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b1);
    LongMonitoredAttributeBase b2 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_AVAILABLE_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfAvailableThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b2);
    LongMonitoredAttributeBase b3 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS,
                MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfBusyThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b3);
    LongMonitoredAttributeBase b4 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME,
                MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.averageWorkCompletionTime());
            }
        };
    threadpoolMonitoredObject.addAttribute(b4);
    LongMonitoredAttributeBase b5 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT,
                MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentProcessedCount());
            }
        };
    threadpoolMonitoredObject.addAttribute(b5);

    // Add the monitored object for the WorkQueue

    threadpoolMonitoredObject.addChild(
            ((WorkQueueImpl)workQueue).getMonitoredObject());
}
 
Example 8
Source File: ThreadPoolImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void initializeMonitoring() {
    // Get root monitored object
    MonitoredObject root = MonitoringFactories.getMonitoringManagerFactory().
            createMonitoringManager(MonitoringConstants.DEFAULT_MONITORING_ROOT, null).
            getRootMonitoredObject();

    // Create the threadpool monitoring root
    MonitoredObject threadPoolMonitoringObjectRoot = root.getChild(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT);
    if (threadPoolMonitoringObjectRoot == null) {
        threadPoolMonitoringObjectRoot =  MonitoringFactories.
                getMonitoredObjectFactory().createMonitoredObject(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT,
                MonitoringConstants.THREADPOOL_MONITORING_ROOT_DESCRIPTION);
        root.addChild(threadPoolMonitoringObjectRoot);
    }
    threadpoolMonitoredObject = MonitoringFactories.
                getMonitoredObjectFactory().
                createMonitoredObject(name,
                MonitoringConstants.THREADPOOL_MONITORING_DESCRIPTION);

    threadPoolMonitoringObjectRoot.addChild(threadpoolMonitoredObject);

    LongMonitoredAttributeBase b1 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentNumberOfThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b1);
    LongMonitoredAttributeBase b2 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_AVAILABLE_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfAvailableThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b2);
    LongMonitoredAttributeBase b3 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS,
                MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfBusyThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b3);
    LongMonitoredAttributeBase b4 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME,
                MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.averageWorkCompletionTime());
            }
        };
    threadpoolMonitoredObject.addAttribute(b4);
    LongMonitoredAttributeBase b5 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT,
                MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentProcessedCount());
            }
        };
    threadpoolMonitoredObject.addAttribute(b5);

    // Add the monitored object for the WorkQueue

    threadpoolMonitoredObject.addChild(
            ((WorkQueueImpl)workQueue).getMonitoredObject());
}
 
Example 9
Source File: ThreadPoolImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void initializeMonitoring() {
    // Get root monitored object
    MonitoredObject root = MonitoringFactories.getMonitoringManagerFactory().
            createMonitoringManager(MonitoringConstants.DEFAULT_MONITORING_ROOT, null).
            getRootMonitoredObject();

    // Create the threadpool monitoring root
    MonitoredObject threadPoolMonitoringObjectRoot = root.getChild(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT);
    if (threadPoolMonitoringObjectRoot == null) {
        threadPoolMonitoringObjectRoot =  MonitoringFactories.
                getMonitoredObjectFactory().createMonitoredObject(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT,
                MonitoringConstants.THREADPOOL_MONITORING_ROOT_DESCRIPTION);
        root.addChild(threadPoolMonitoringObjectRoot);
    }
    threadpoolMonitoredObject = MonitoringFactories.
                getMonitoredObjectFactory().
                createMonitoredObject(name,
                MonitoringConstants.THREADPOOL_MONITORING_DESCRIPTION);

    threadPoolMonitoringObjectRoot.addChild(threadpoolMonitoredObject);

    LongMonitoredAttributeBase b1 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentNumberOfThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b1);
    LongMonitoredAttributeBase b2 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_AVAILABLE_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfAvailableThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b2);
    LongMonitoredAttributeBase b3 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS,
                MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfBusyThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b3);
    LongMonitoredAttributeBase b4 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME,
                MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.averageWorkCompletionTime());
            }
        };
    threadpoolMonitoredObject.addAttribute(b4);
    LongMonitoredAttributeBase b5 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT,
                MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentProcessedCount());
            }
        };
    threadpoolMonitoredObject.addAttribute(b5);

    // Add the monitored object for the WorkQueue

    threadpoolMonitoredObject.addChild(
            ((WorkQueueImpl)workQueue).getMonitoredObject());
}
 
Example 10
Source File: ThreadPoolImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void initializeMonitoring() {
    // Get root monitored object
    MonitoredObject root = MonitoringFactories.getMonitoringManagerFactory().
            createMonitoringManager(MonitoringConstants.DEFAULT_MONITORING_ROOT, null).
            getRootMonitoredObject();

    // Create the threadpool monitoring root
    MonitoredObject threadPoolMonitoringObjectRoot = root.getChild(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT);
    if (threadPoolMonitoringObjectRoot == null) {
        threadPoolMonitoringObjectRoot =  MonitoringFactories.
                getMonitoredObjectFactory().createMonitoredObject(
                MonitoringConstants.THREADPOOL_MONITORING_ROOT,
                MonitoringConstants.THREADPOOL_MONITORING_ROOT_DESCRIPTION);
        root.addChild(threadPoolMonitoringObjectRoot);
    }
    threadpoolMonitoredObject = MonitoringFactories.
                getMonitoredObjectFactory().
                createMonitoredObject(name,
                MonitoringConstants.THREADPOOL_MONITORING_DESCRIPTION);

    threadPoolMonitoringObjectRoot.addChild(threadpoolMonitoredObject);

    LongMonitoredAttributeBase b1 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentNumberOfThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b1);
    LongMonitoredAttributeBase b2 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_AVAILABLE_THREADS,
                MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfAvailableThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b2);
    LongMonitoredAttributeBase b3 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS,
                MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.numberOfBusyThreads());
            }
        };
    threadpoolMonitoredObject.addAttribute(b3);
    LongMonitoredAttributeBase b4 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME,
                MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.averageWorkCompletionTime());
            }
        };
    threadpoolMonitoredObject.addAttribute(b4);
    LongMonitoredAttributeBase b5 = new
        LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT,
                MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION) {
            public Object getValue() {
                return new Long(ThreadPoolImpl.this.currentProcessedCount());
            }
        };
    threadpoolMonitoredObject.addAttribute(b5);

    // Add the monitored object for the WorkQueue

    threadpoolMonitoredObject.addChild(
            ((WorkQueueImpl)workQueue).getMonitoredObject());
}