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();
}
}
Aggregations