// only call beforeCompletion on beans with session synchronization
if (!synchronization.isCallSessionSynchronization()) continue;
// Invoke beforeCompletion
ThreadContext callContext = new ThreadContext(instance.deploymentInfo, instance.primaryKey, Operation.BEFORE_COMPLETION);
callContext.setCurrentAllowedStates(StatefulContext.getStates());
ThreadContext oldCallContext = ThreadContext.enter(callContext);
try {
instance.setInUse(true);
Method beforeCompletion = SessionSynchronization.class.getMethod("beforeCompletion");