// synchronized to prevent overriding of the class loader
// and also calls to predeploy and undeploy by other threads -
// the latter may alter result of shouldRedeploy method.
synchronized(emSetupImpl) {
if(emSetupImpl.shouldRedeploy()) {
SEPersistenceUnitInfo persistenceInfo = (SEPersistenceUnitInfo)emSetupImpl.getPersistenceUnitInfo();
persistenceInfo.setClassLoader(initializationHelper.getClassLoader(emName, properties));
if (emSetupImpl.isUndeployed()){
persistenceInfo.setNewTempClassLoader(initializationHelper.getClassLoader(emName, properties));
}
}
// 253701: cache a reference to (this) PersistenceProvider's initializer for later use during undeploy()
emSetupImpl.setPersistenceInitializationHelper(this.initializationHelper);