|
|
|
@ -93,27 +93,22 @@ public class EndpointMBean implements DynamicMBean {
|
|
|
|
|
return invoke(operation, params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Object invoke(JmxOperation operation, Object[] params) throws MBeanException {
|
|
|
|
|
private Object invoke(JmxOperation operation, Object[] params)
|
|
|
|
|
throws MBeanException, ReflectionException {
|
|
|
|
|
try {
|
|
|
|
|
String[] parameterNames = operation.getParameters().stream()
|
|
|
|
|
.map(JmxOperationParameter::getName).toArray(String[]::new);
|
|
|
|
|
Map<String, Object> arguments = getArguments(parameterNames, params);
|
|
|
|
|
Object result = invokeOperation(operation, arguments);
|
|
|
|
|
Object result = operation
|
|
|
|
|
.invoke(new InvocationContext(SecurityContext.NONE, arguments));
|
|
|
|
|
if (REACTOR_PRESENT) {
|
|
|
|
|
result = ReactiveHandler.handle(result);
|
|
|
|
|
}
|
|
|
|
|
return this.responseMapper.mapResponse(result);
|
|
|
|
|
}
|
|
|
|
|
catch (InvalidEndpointRequestException ex) {
|
|
|
|
|
throw new IllegalArgumentException(ex.getMessage(), ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Object invokeOperation(JmxOperation operation,
|
|
|
|
|
Map<String, Object> arguments) throws MBeanException {
|
|
|
|
|
try {
|
|
|
|
|
return operation.invoke(new InvocationContext(SecurityContext.NONE,
|
|
|
|
|
arguments));
|
|
|
|
|
throw new ReflectionException(new IllegalArgumentException(
|
|
|
|
|
ex.getMessage()), ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex) {
|
|
|
|
|
throw new MBeanException(translateIfNecessary(ex), ex.getMessage());
|
|
|
|
|