Object (Object child) { Class<?> childClass = child.getClass(); Class<?>[] childInterfaces = childClass.getInterfaces(); LOG.assertTrue(childInterfaces.length == 1, "Child class is expected to implement single child interface"); Class<?> childInterface = childInterfaces[0]; Class<?> callerChildInterface; try { callerChildInterface = myCallerClassLoader.loadClass(childInterface.getName()); } catch (ClassNotFoundException e) { LOG.error(e); return null; } Object preWrappedChild; if (myPreWrapperFactory == null) { preWrappedChild = child; } else { preWrappedChild = ReflectionUtil.proxy(callerChildInterface, myPreWrapperFactory.createWrapperInvocationHandler(child)); } return ReflectionUtil.proxy(callerChildInterface, new ThreadInvocationHandler(myTaskExecutor, myCallerClassLoader, preWrappedChild, myPreWrapperFactory)); }