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