/**
  * Create EE container entity manager factory
  *
  * @return EntityManagerFactory
  */
 private EntityManagerFactory createContainerEntityManagerFactory() {
   persistenceProviderAdaptor.beforeCreateContainerEntityManagerFactory(pu);
   try {
     return persistenceProvider.createContainerEntityManagerFactory(pu, properties.getValue());
   } finally {
     try {
       persistenceProviderAdaptor.afterCreateContainerEntityManagerFactory(pu);
     } finally {
       pu.setAnnotationIndex(
           null); // close reference to Annotation Index (only needed during call to
                  // createContainerEntityManagerFactory)
       // This is needed if the datasource is restarted
       // pu.setTempClassLoaderFactory(null);    // close reference to temp classloader factory
       // (only needed during call to createEntityManagerFactory)
     }
   }
 }