Closed GoogleCodeExporter closed 8 years ago
I don't understand this one :-) can you elaborate?
Original comment by virgo47
on 24 Jul 2014 at 9:44
Sorry for my delayed answer.
For generic JMX access to simon attributes I'm using the next classes
public class MonitorStopwatchMXBeanImpl extends StopwatchMXBeanImpl implements
MonitorStopwatchMXBean {
public MonitorStopwatchMXBeanImpl(Stopwatch stopwatch) {
super(stopwatch);
}
/**
* {@inheritDoc}
*/
@Override
public List<String[]> getAttributes() {
List<String[]> attributes = new ArrayList<String[]>();
Iterator<String> iterator = simon().getAttributeNames();
while (iterator.hasNext()) {
String key = iterator.next();
Object attr = simon().getAttribute(key);
String value = attr != null ? String.valueOf(attr) : null;
String[] attrib = new String[2];
attrib[0] = key;
attrib[1] = value;
attributes.add(attrib);
}
return attributes;
}
}
public class MonitorCounterMXBeanImpl extends CounterMXBeanImpl implements
MonitorCounterMXBean {
public MonitorCounterMXBeanImpl(Counter counter) {
super(counter);
}
/**
* {@inheritDoc}
*/
@Override
public List<String[]> getAttributes() {
List<String[]> attributes = new ArrayList<String[]>();
Iterator<String> iterator = simon().getAttributeNames();
while (iterator.hasNext()) {
String key = iterator.next();
Object attr = simon().getAttribute(key);
String value = attr != null ? String.valueOf(attr) : null;
String[] attrib = new String[2];
attrib[0] = key;
attrib[1] = value;
attributes.add(attrib);
}
return attributes;
}
As a side effect I must extend also MonitorJmxRegisterCallback. Much convenient
sollution is to have these methods in StopwatchMXBeanImpl and CounterMXBeanImpl
Original comment by Vladimir...@gmail.com
on 7 Aug 2014 at 4:59
Hi Vlado, please feel free to add them there, you're still commiter after all.
:-) That way you can do it exactly as you like and test it. If I understand
there should added classes, right? Feel free to push it to master.
If it is a problem for you I can do it, but I can't test your usecase.
Original comment by virgo47
on 8 Aug 2014 at 7:15
Closed here - open as https://github.com/virgo47/javasimon/issues/3
Original comment by virgo47
on 29 Oct 2014 at 10:03
Original issue reported on code.google.com by
Vladimir...@gmail.com
on 12 Jul 2014 at 12:12