private static Object newInstance(final JBossServiceConfig serviceConfig, final List<ClassReflectionIndex<?>> mBeanClassHierarchy, final ClassLoader deploymentClassLoader) throws DeploymentUnitProcessingException {
// set TCCL so that the MBean instantiation happens in the deployment's classloader
final ClassLoader oldTCCL = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(deploymentClassLoader);
try {
final JBossServiceConstructorConfig constructorConfig = serviceConfig.getConstructorConfig();
final int paramCount = constructorConfig != null ? constructorConfig.getArguments().length : 0;
final Class<?>[] types = new Class<?>[paramCount];
final Object[] params = new Object[paramCount];
if (constructorConfig != null) {
final Argument[] arguments = constructorConfig.getArguments();
for (int i = 0; i < paramCount; i++) {
final Argument argument = arguments[i];
types[i] = ReflectionUtils.getClass(argument.getType(), deploymentClassLoader);
params[i] = newValue(ReflectionUtils.getClass(argument.getType(), deploymentClassLoader), argument.getValue());
}