Java 8 GaugeMonitor - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 GaugeMonitor class.

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, setNotifyHigh, setNotifyLow, setThresholds
    /** 
     * Update the gauge and check for notifications 
     */ 
    public int gaugeMonitorNotification() throws Exception {
 
        GaugeMonitor gaugeMonitor = new GaugeMonitor();
        try { 
            // Create a new GaugeMonitor MBean and add it to the MBeanServer. 
            // 
            echo(">>> CREATE a new GaugeMonitor MBean"); 
            ObjectName gaugeMonitorName = new ObjectName(
                            domain + ":type=" + GaugeMonitor.class.getName());
            server.registerMBean(gaugeMonitor, gaugeMonitorName);
 
            echo(">>> ADD a listener to the GaugeMonitor"); 
            gaugeMonitor.addNotificationListener(this, null, null);
 
            // 
            // MANAGEMENT OF A STANDARD MBEAN 
            // 

3
CodeRank
This code example shows how to use the following methods:sleep, addNotificationListener, setNotifyHigh, setNotifyLow, setThresholds
    /** 
     * Update the gauge and check for notifications 
     */ 
    public int gaugeMonitorNotification() throws Exception {
 
        GaugeMonitor gaugeMonitor = new GaugeMonitor();
        try { 
            // Create a new GaugeMonitor MBean and add it to the MBeanServer. 
            // 
            echo(">>> CREATE a new GaugeMonitor MBean"); 
            ObjectName gaugeMonitorName = new ObjectName(
                            domain + ":type=" + GaugeMonitor.class.getName());
            server.registerMBean(gaugeMonitor, gaugeMonitorName);
 
            echo(">>> ADD a listener to the GaugeMonitor"); 
            gaugeMonitor.addNotificationListener(this, null, null);
 
            // 
            // MANAGEMENT OF A STANDARD MBEAN 
            // 

3
CodeRank
See Code Examples for Java 8 GaugeMonitor Methods: