ThreadContext callContext = ThreadContext.getThreadContext();
Object localClientIdentity = ClientSecurity.getIdentity();
try {
if (callContext == null && localClientIdentity != null) {
SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
securityService.associate(localClientIdentity);
}
if (strategy == CLASSLOADER_COPY) {
IntraVmCopyMonitor.pre(strategy);
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getDeploymentInfo().getClassLoader());
try {
args = copyArgs(args);
method = copyMethod(method);
interfce = copyObj(interfce);
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
IntraVmCopyMonitor.post();
}
} else if (strategy == COPY && args != null && args.length > 0) {
IntraVmCopyMonitor.pre(strategy);
try {
args = copyArgs(args);
} finally {
IntraVmCopyMonitor.post();
}
}
try {
Object returnValue = _invoke(proxy, interfce, method, args);
return copy(strategy, returnValue);
} catch (Throwable throwable) {
throwable = copy(strategy, throwable);
throw convertException(throwable, method, interfce);
}
} finally {
if (callContext == null && localClientIdentity != null) {
SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
securityService.disassociate();
}
}
}