if (security) {
currentSecurityContext = securityContext.getCurrentSecurityContext();
}
ComponentInvocation currentInvocation = invocationManager.getCurrentInvocation();
if (currentInvocation != null) {
savedInvocation = currentInvocation.clone();
savedInvocation.instance = currentInvocation.instance;
savedInvocation.setResourceTableKey(null);
if (!naming) {
savedInvocation.setJNDIEnvironment(null);
}