在我的基於Spring 3.1的應用程序中,@ManagedAttributes和@ManagedOperations都未被捕獲或記錄。 - 春天似乎默認情況下,出口的所有操作/屬性
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;
}
}
};
}
}
來源
2013-12-12 08:58:51
bla
我沒有使用任何註釋:
所以我通過擴展的MBeanExporter的,其失敗每當MBean的方法調用失敗去了。我會嘗試在有問題的操作中添加一個註釋,然後看看它做了什麼,謝謝。 – 2010-09-07 19:04:42
在我的應用程序中,@ManagedOperation方法沒有被捕獲和記錄 – bla 2013-12-12 08:52:58