code: @Override
      public final EntityManager createEntityManager(Map map)
      {
          // For Application managed persistence context, type is always EXTENDED
          if (isOpen())
          {
              return new EntityManagerImpl(this, map, transactionType, PersistenceContextType.EXTENDED);
          }
          throw new IllegalStateException("Entity manager factory has been closed.");
      }
docs: Create a new application-managed EntityManager with the specified Map of
  properties. This method returns a new EntityManager instance each time it
  is invoked. The isOpen method will return true on the returned instance.
  
  @param map
  properties for entity manager
  @return entity manager instance
  @throws IllegalStateException
  if the entity manager factory has been closed