Monitor setObservedAttribute - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Monitor setObservedAttribute method.

This code example shows how to use the following methods:setNotifyHigh, setThresholds, start, addObservedObject, setObservedAttribute
	public void setLowerThreshold(int lowerThreshold) {
		this.lowerThreshold = lowerThreshold;
	} 
 
	public GaugeMonitor getObject() throws Exception {
		GaugeMonitor monitor = new GaugeMonitor();
		monitor.setNotifyHigh(true);
		monitor.addObservedObject(new ObjectName(String.format("%s:type=JobExecution,name=%s,step=%s", defaultDomain,
				jobName, stepName)));
		monitor.setObservedAttribute(observedAttribute);
		if (observedAttribute.endsWith("Duration")) {
			monitor.setThresholds(new Double(upperThreshold), new Double(lowerThreshold));
		} 
		else { 
			monitor.setThresholds(new Integer(upperThreshold), new Integer(lowerThreshold));
		} 
		if (autoStart) {
			monitor.start();
		} 
		return monitor;

5
CodeRank
This code example shows how to use the following methods:sleep, addNotificationListener, setInitThreshold, setNotify, start
    /** 
     * Update the counter and check for notifications 
     */ 
    public int counterMonitorNotification() throws Exception {
 
        CounterMonitor counterMonitor = new CounterMonitor();
        try { 
            // Create a new CounterMonitor MBean and add it to the MBeanServer. 
            // 
            echo(">>> CREATE a new CounterMonitor MBean"); 
            ObjectName counterMonitorName = new ObjectName(
                            domain + ":type=" + CounterMonitor.class.getName());
            server.registerMBean(counterMonitor, counterMonitorName);
 
            echo(">>> ADD a listener to the CounterMonitor"); 
            counterMonitor.addNotificationListener(this, null, null);
 
            // 
            // MANAGEMENT OF A STANDARD MBEAN 
            // 

4
CodeRank
This code example shows how to use the following methods:sleep, addNotificationListener, setInitThreshold, setNotify, start
    /** 
     * Update the counter and check for notifications 
     */ 
    public int counterMonitorNotification() throws Exception {
 
        CounterMonitor counterMonitor = new CounterMonitor();
        try { 
            // Create a new CounterMonitor MBean and add it to the MBeanServer. 
            // 
            echo(">>> CREATE a new CounterMonitor MBean"); 
            ObjectName counterMonitorName = new ObjectName(
                            domain + ":type=" + CounterMonitor.class.getName());
            server.registerMBean(counterMonitor, counterMonitorName);
 
            echo(">>> ADD a listener to the CounterMonitor"); 
            counterMonitor.addNotificationListener(this, null, null);
 
            // 
            // MANAGEMENT OF A STANDARD MBEAN 
            // 

4
CodeRank
setObservedAttribute Method Overview
Sets the attribute to observe.
See Code Examples for other Java 8 Monitor Methods: