You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am very keen to switch to this JMX enabling library and move away from pojo-mbean, as the features here are a more natural fit. However, I am having trouble letting the export process "discover" managed beans as they are injected, a pattern I have used to great effect previously.
Using jmxutils, the following works:
but using Listeners doesn't (I'm using the ManagedBean annotation to "mark" my class...assume that MyClass has that annotation):
private ExportBinder exporter;
@Override
protected void configure() {
bind(MBeanServer.class).toInstance(ManagementFactory.getPlatformMBeanServer());
bindListener(Matchers.any(), new JmxTypeListener());
install(new MBeanModule());
exporter = ExportBinder.newExporter(binder());
}
private class JmxTypeListener implements TypeListener {
@Override
public <I> void hear(TypeLiteral<I> type, final TypeEncounter<I> encounter) {
final Class<? super I> rawType = type.getRawType();
if (rawType.isAnnotationPresent(ManagedBean.class)) {
exporter.export(rawType).withGeneratedName(); //this seems to have no effect!
...
Everything executes as expected, but no entry shows up in the jmx console for the second approach. Is it too late to export beans by the time the listener is "hearing" bindings? Is there any workaround that means I don't have to explicitly export beans by type?
The text was updated successfully, but these errors were encountered:
I am very keen to switch to this JMX enabling library and move away from pojo-mbean, as the features here are a more natural fit. However, I am having trouble letting the export process "discover" managed beans as they are injected, a pattern I have used to great effect previously.
Using jmxutils, the following works:
but using Listeners doesn't (I'm using the ManagedBean annotation to "mark" my class...assume that MyClass has that annotation):
Everything executes as expected, but no entry shows up in the jmx console for the second approach. Is it too late to export beans by the time the listener is "hearing" bindings? Is there any workaround that means I don't have to explicitly export beans by type?
The text was updated successfully, but these errors were encountered: