code: static EntityManager unbind(EntityManagerFactory factory) {
          final Map<EntityManagerFactory,EntityManager> entityManagerMap = entityManagerMap(false);
          EntityManager existing = null;
          if ( entityManagerMap != null ) {
              existing = entityManagerMap.remove( factory );
              doCleanup();
          }
          return existing;
      }
docs: Unbinds the EntityManager, if any, currently associated with the context for the
  given EntityManagerFactory.
  
  @param factory the factory for which to unbind the current EntityManager.
  @return the bound entity manager, if any; else null.