docs: @Override
      EntityManager getEMInvocationInfo(boolean requireTx, LockModeType mode)
      {
          // Obtain the extended-scoped persistence context binding accessor from
          // the JPA Service, which was registered by the EJB Container.     d515803
          JPAExPcBindingContextAccessor exPcAccessor = ivAbstractJPAComponent.getExPcBindingContext(); // F743-18776
  
          // This should never occur, but if it somehow does, then just throw
          // a meaningful exception to let us know what occurred.            d515803
          if (exPcAccessor == null)
          {
              throw new IllegalStateException("The EJB container has not registered an extended-scoped persistence context binding context accessor with the JPA service.  An accessor is required to provide extended-scoped persistence context management for stateful beans.");
          }
  
          JPAExPcBindingContext currentContext = exPcAccessor.getExPcBindingContext();
  
          //TODO: ejbteam:  The currentContext may be null when attempting to use a container managed extended
          // persistence context from an asynchbeans thread.   This will need to be fixed
          // in Pyxis, but until then we will throw a more meaningful exception. //473813
          if (currentContext == null)
          {
              Tr.error(tc, "NO_COMPONENT_CONTEXT_CWWJP0038E", ivPuRefId.getPuName()); // d479669
  
              throw new RuntimeException("The component context does not exist on the thread." +
                                         "  The server run time environment is not able to associate the operation" +
                                         " thread with any Java Platform, Enterprise Edition 5 (Java EE 5)" +
                                         " application component.  This condition can occur when the client attempts" +
                                         " EntityManager operations on a non-server application thread." +
                                         "  Make sure that a Java EE 5 application does not execute EntityManager" +
                                         " operations within static code blocks or in threads that are created by" +
                                         " the Java EE application.");
          }
  
          UOWCoordinator uowCoord = ivAbstractJPAComponent.getUOWCurrent().getUOWCoord();
          SynchronizationRegistryUOWScope uowSyncRegistry = getSynchronizationRegistryUOWScope(uowCoord);
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              Tr.entry(tc, "getEMInvocationInfo", "tid=" + txIdToString(uowCoord), currentContext.thisToString());
  
          boolean globalTx = uowCoord.isGlobal();
  
          // Begins d597764
          if (!globalTx && mode != null && !LockModeType.NONE.equals(mode))
          {
              if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                  Tr.exit(tc, "getEMInvocationInfo : TransactionRequiredException: " +
                              "No active transaction for " + ivPuRefId);
  
              throw new TransactionRequiredException("No active transaction for " + ivPuRefId);
          }
          // Ends d597764
  
          // JPA 5.6.3.1 Requirements for Persistence Context Propagation
          //
          // Persistence contexts are propagated by the container across component invocations as follows.
          //
          // If a component is called and there is no JTA transaction or the JTA transaction is not
          // propagated, the persistence context is not propagated.
          // * If an entity manager is then invoked from within the component:
          // ** Invocation of an entity manager defined with PersistenceContext-Type.TRANSACTION will
          //      result in use of a new persistence context (as described in section 5.6.1).
          // ** Invocation of an entity manager defined with PersistenceContext-Type.EXTENDED will
          //      result in the use of the existing extended persistence context bound to that component.
          // ** If the entity manager is invoked within a JTA transaction, the persistence context will
          //      be bound to the JTA transaction.
          //
          // If a component is called and the JTA transaction is propagated into that component:
          // * If the component is a stateful session bean to which an extended persistence context
          //      has been bound and there is a different persistence context bound to the JTA transaction,
          //      an EJBException is thrown by the container.
          // * (JPA 2.1: 7.6.4.1) If there is a persistence context of type SynchronizationType.UNSYNCHRONIZED 
          //      associated with the JTA transaction and the target component specifies a persistence context of type 
          //      SynchronizationType.SYNCHRONIZED, the IllegalStateException is thrown by the container.
          // * Otherwise, if there is a persistence context bound to the JTA transaction, that
          //      persistence context is propagated and used.
          //
          // (JPA 2.1: 7.6.4.1) Note that a component with a persistence context of type  
          // SynchronizationType.UNSYNCHRONIZED may be called by a component propagating either a persistence context of  
          // type SynchronizationType.UNSYNCHRONIZED or a persistence context of type SynchronizationType.SYNCHRONIZED 
          // into it.
  
          // JPA 5.9.1 Container Responsibilities
          //
          // For stateful session beans with extended persistence contexts:
          // * The container creates an entity manager by calling
          //   EntityManagerFactory.createEntityManager when a stateful session bean is created that
          //   declares a dependency on an entity manager with PersistenceContextType.EXTENDED.
          //   (See section 5.6.2).
          // * The container closes the entity manager by calling EntityManager.close after the
          //   stateful session bean and all other stateful session beans that have inherited the
          //   same persistence context as the EntityManager have been removed.
  
          // ExPC is different than TxPC on how the em is determined. However the transaction propagation
          //  semantics may be required to handle mix Tx/Em Pc invocations and ExPc exception rules.
  
          ExPcBindingKey exPcBindingKey = new ExPcBindingKey(currentContext.getBindId(), ivPuRefId);
          ExPcBindingInfo exPcInfo = getExPcBindingInfo(exPcBindingKey);
  
          // creation of provider EntityManager is deferred until first use.
          if (exPcInfo.em == null)
          {
              exPcInfo.em = ivEntityManagerPool.getEntityManager(globalTx, ivUnsynchronized); // d510184
              exPcInfo.txKeyPuId = ivTxKeyPuId;
          }
          EntityManager em = exPcInfo.em;
  
          if (globalTx)
          {
              JPAExEmInvocation invocationEm = getInvocation(uowSyncRegistry, ivTxKeyPuId); // d683375, d689596
              if (invocationEm == null)
              {
                  invocationEm = ivAbstractJPAComponent.getJPARuntime().createExEmInvocation(uowCoord, em, ivUnsynchronized);
                  setInvocation(uowSyncRegistry, ivTxKeyPuId, invocationEm); // d683375, d689596
  
                  // JPA 5.9.1 Container Responsibilities
                  //
                  // For stateful session beans with extended persistence contexts:
                  // ** (JPA 2.1: 7.9.1) When a business method of the stateful session bean is invoked, if the stateful 
                  //   session bean uses container managed transaction demarcation, and the entity manager is not already 
                  //   associated with the current JTA transaction, the container associates the entity manager with the 
                  //   current JTA transaction and, if the persistence context is of type SynchronizationType.SYNCHRONIZED, 
                  //   the container calls EntityManager.joinTransaction. If there is a different persistence context 
                  //   already associated with the JTA transaction, the container throws the EJBException.
                  // ** (JPA 2.1: 7.9.1) When a business method of the stateful session bean is invoked, if the stateful 
                  //   session bean uses bean managed transaction demarcation and a UserTransaction is begun within the 
                  //   method, the container associates the persistence context with the JTA transaction and, if the 
                  //   persistence context is of type SynchronizationType.SYNCHRONIZED, the container calls 
                  //   EntityManager.joinTransaction. 
                  boolean isCmt = !currentContext.isBmt();
                  boolean isBmtNUserTxBegunInMethod = currentContext.isBmt()
                                                      && currentContext.hasBmtUserTxBegunInMethod();
                  if (!ivUnsynchronized && (isCmt || isBmtNUserTxBegunInMethod))
                  {
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                          Tr.debug(tc, "CMT=" + isCmt + ", UserTxBegun=" + isBmtNUserTxBegunInMethod + " -> em=" + em);
                      em.joinTransaction();
                  }
              }
              else
              {
                  // JPA 5.9.1 Container Responsibilities
                  //
                  // For stateful session beans with extended persistence contexts:
                  // ** If there is a different persistence context already associated with the JTA
                  //    transaction, the container throws the EJBException.
                  if (invocationEm.ivEm != em)
                  {
                      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                          Tr.exit(tc, "getEMInvocationInfo : Different persistence context already associate with a JTA tx.");
                      throw exPcAccessor.newEJBException
                                      ("5.9.1 A persistence context is associated to the current JTA transaction " +
                                       "and it is different than the extend-scoped persistence context bound to this SFSB.");
                  }
              }
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              Tr.exit(tc, "getEMInvocationInfo : " + em);
          return em;
      }