Search in sources :

Example 1 with ConsistentRegionMXBean

use of com.ibm.streams.operator.control.ConsistentRegionMXBean in project streamsx.topology by IBMStreams.

the class Resetter method setup.

@Override
public void setup(MBeanServerConnection mbs, OperatorContext context) throws InstanceNotFoundException, Exception {
    seq.increment();
    ObjectName consistentWildcard = ObjectName.getInstance("com.ibm.streams.control:type=consistent,index=*");
    Set<ObjectName> regions = mbs.queryNames(consistentWildcard, null);
    if (regions.isEmpty()) {
        fail.setValue(1);
        trace.severe("No consistent regions!");
        return;
    }
    for (ObjectName name : regions) {
        ConsistentRegionMXBean crbean = JMX.newMXBeanProxy(mbs, name, ConsistentRegionMXBean.class, true);
        if (trace.isLoggable(Level.FINE))
            trace.fine("Discovered consistent region: " + crbean.getName());
        String metricName = "nResets." + crbean.getName();
        Metric resetCount;
        try {
            resetCount = context.getMetrics().createCustomMetric(metricName, "Requested resets for region", Metric.Kind.COUNTER);
        } catch (IllegalArgumentException e) {
            resetCount = context.getMetrics().getCustomMetric(metricName);
        }
        resetCounts.add(resetCount);
        scheduleReset(crbean, resetCount);
        seq.increment();
    }
}
Also used : Metric(com.ibm.streams.operator.metrics.Metric) ConsistentRegionMXBean(com.ibm.streams.operator.control.ConsistentRegionMXBean) ObjectName(javax.management.ObjectName)

Aggregations

ConsistentRegionMXBean (com.ibm.streams.operator.control.ConsistentRegionMXBean)1 Metric (com.ibm.streams.operator.metrics.Metric)1 ObjectName (javax.management.ObjectName)1