persistence/play-java-jpa/src/main/java/play/db/jpa/JPAEntityManagerContext.java
void pushOrPopEm(EntityManager em, boolean threadLocalFallback) {
    Deque<EntityManager> ems = this.emStack(threadLocalFallback);
    if (em != null) {
      ems.push(em);
    } else {
      if (ems.isEmpty()) {
        throw new IllegalStateException("Tried to remove the EntityManager, but none was set.");
      }
      ems.pop();
    }
  }
void pushOrPopEm(EntityManager em, boolean threadLocalFallback) {
    Deque<EntityManager> ems = this.emStack(threadLocalFallback);
    if (em != null) {
      ems.push(em);
    } else {
      if (ems.isEmpty()) {
        throw new IllegalStateException("Tried to remove the EntityManager, but none was set.");
      }
      ems.pop();
    }
  }
void pushOrPopEm ( EntityManager em , boolean threadLocalFallback ) { Deque < EntityManager > ems = this . emStack ( threadLocalFallback ) ; if ( em != null ) { ems . push ( em ) ; } else { if ( ems . isEmpty ( ) ) { throw new IllegalStateException ( "Tried to remove the EntityManager, but none was set." ) ; } ems . pop ( ) ; } }
Pushes or pops the EntityManager stack depending on the value of the em argument. If em is
null, then the current EntityManager is popped. If em is non-null, then em is pushed onto the
stack and becomes the current EntityManager.

@param em the entity manager to push, if null then will pop one off the stack.
@param threadLocalFallback if true, fall back to a ThreadLocal queue of entity managers if no
HTTP.Context object is found.
Pushes or pops the EntityManager stack depending on the value of the em argument . If em is null then the current EntityManager is popped . If em is non - null then em is pushed onto the stack and becomes the current EntityManager .