Make APIMBean name derivation check interface fields as well.

This commit is contained in:
elcallio 2016-10-11 14:01:35 +02:00 committed by Calle Wilund
parent cd9deafc51
commit 781821ac9e
1 changed files with 12 additions and 0 deletions

View File

@ -133,6 +133,18 @@ public class APIMBean implements MBeanRegistration {
} catch (Throwable t) {
}
}
if (mbeanName == null) {
for (Class<?> c : getClass().getInterfaces()) {
Field f;
try {
f = c.getDeclaredField("OBJECT_NAME");
f.setAccessible(true);
mbeanName = (String) f.get(null);
break;
} catch (Throwable t) {
}
}
}
if (mbeanName == null) {
String name = getClass().getName();
int i = name.lastIndexOf('.');