// it has been undeployed by factory.close() in another thread - start all over again.
return (EntityManagerFactoryImpl) createEntityManagerFactory(puName, properties);
}
}
EntityManagerFactoryImpl factory = null;
try {
factory = new EntityManagerFactoryImpl(emSetupImpl, properties);
emSetupImpl.setRequiresConnection(requiresConnection);
// This code has been added to allow validation to occur without actually calling createEntityManager
if (emSetupImpl.shouldGetSessionOnCreateFactory(properties)) {
factory.getDatabaseSession();
}
return factory;
} catch (RuntimeException ex) {
if (factory != null) {
factory.close();
} else {
emSetupImpl.undeploy();
}
throw ex;