if (handle.getSecurityContext() != null) {
resetSecurityContext = securityContext.getCurrentSecurityContext();
securityContext.setCurrentSecurityContext(handle.getSecurityContext());
}
if (handle.getInvocation() != null) {
ComponentInvocation invocation = handle.getInvocation();
// Each invocation needs a ResourceTableKey that returns a unique hashCode for TransactionManager
invocation.setResourceTableKey(new PairKey(invocation.getInstance(), Thread.currentThread()));
invocationManager.preInvoke(invocation);
}
// Ensure that there is no existing transaction in the current thread
if (transactionManager != null) {
transactionManager.clearThreadTx();