Dans mon application basée sur Spring 3.1, ni @ManagedAttributes ni @ManagedOperations ne sont interceptés ou consignés.
donc je suis passé par une extension de MBeanExporter, qui échoue à chaque fois qu'un appel de méthode MBean échoue:
public class LoggingFailedCallsMBeanExporter extends MBeanExporter {
protected ModelMBean createModelMBean() throws MBeanException {
// super method does:
// return (this.exposeManagedResourceClassLoader ? new SpringModelMBean() : new RequiredModelMBean());
ModelMBean superModelMBean = super.createModelMBean();
// but this.exposeManagedResourceClassLoader is not visible, so we switch on the type of the returned ModelMBean
if (superModelMBean instanceof SpringModelMBean) {
return new SpringModelMBean() {
@Override
public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException {
try {
return super.invoke(opName, opArgs, sig);
} catch (MBeanException e) {
LOGGER.warn("Issue on a remote call", e);
throw e;
} catch (ReflectionException e) {
LOGGER.warn("Issue on a remote call", e);
throw e;
} catch (RuntimeException e) {
LOGGER.warn("Issue on a remote call", e);
throw e;
} catch (Error e) {
LOGGER.warn("Issue on a remote call", e);
throw e;
}
}
};
} else {
return new RequiredModelMBean() {
@Override
public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException {
try {
return super.invoke(opName, opArgs, sig);
} catch (MBeanException e) {
LOGGER.warn("Issue on a remote call", e);
throw e;
} catch (ReflectionException e) {
LOGGER.warn("Issue on a remote call", e);
throw e;
} catch (RuntimeException e) {
LOGGER.warn("Issue on a remote call", e);
throw e;
} catch (Error e) {
LOGGER.warn("Issue on a remote call", e);
throw e;
}
}
};
}
}
Je n'utilisais pas des annotations - Le printemps semble par l'exportation par défaut toutes les opérations/attributs. Je vais essayer d'ajouter une annotation sur l'opération en question et voir ce que cela fait, merci. –
Dans mon application, les méthodes @ManagedOperation ne sont pas interceptées et enregistrées – bla