docs: @Override
      EntityManager getEMInvocationInfo(boolean requireTx, LockModeType mode)
      {
          UOWCoordinator uowCoord = ivAbstractJPAComponent.getUOWCurrent().getUOWCoord();
          SynchronizationRegistryUOWScope uowSyncRegistry = getSynchronizationRegistryUOWScope(uowCoord);
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              Tr.entry(tc, "getEMInvocationInfo : " + requireTx + " : tid=" + txIdToString(uowCoord));
  
          boolean globalTx = uowCoord.isGlobal();
  
          // The container must throw the TransactionRequiredException if a transaction-scoped
          // persistence context is used, and the EntityManager persist, remove, merge, or refresh
          // method is invoked when no transaction is active.
          if (!globalTx && (requireTx || (mode != null && !LockModeType.NONE.equals(mode)))) //d597764
          {
              if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                  Tr.exit(tc, "getEMInvocationInfo : TransactionRequiredException: " +
                              "No active transaction for " + ivPuRefId);
  
              // The provider is not responsible to throw this exception for
              //  persist, remove, refresh and merge methods since these methods are supported in
              //  extend-scoped persistence context. The "container" must enforced this
              //  rule per JPA spec.
              throw new TransactionRequiredException("No active transaction for " + ivPuRefId);
          }
  
          // (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.
          // * Otherwise, if there is a persistence context bound to the JTA transaction, that
          //      persistence context is propagated and used.
  
          JPAExEmInvocation invocationEm = getInvocation(uowSyncRegistry, ivTxKeyPuId); // d683375, d689596
          if (invocationEm == null)
          {
              EntityManager em = ivEntityManagerPool.getEntityManager(globalTx, ivUnsynchronized); // d510184
              if (globalTx)
              {
                  // 5.9.1 Container Responsibilities
                  //  For the management of a transaction-scoped persistence context, if there is no
                  //  EntityManager already associated with the JTA transaction:
                  //  * The container creates a new entity manager by calling EntityManagerFactory.createEntityManager
                  //      when the first invocation of an entity manager with PersistenceContextType.TRANSACTION
                  //      occurs within the scope of a business method executing in the JTA transaction.
                  //
                  //  When the container creates an entity manager, it may pass a map of properties to the
                  //      persistence provider by using the EntityManagerFactory.createEntityManager(Map map)
                  //      method. If properties have been specified in the PersistenceContext annotation or
                  //      the persistence-context-ref deployment descriptor element, this method must be
                  //      used and the map must include the specified properties.
  
                  JPATxEmInvocation txEmInvocation = createJPATxEmInvocation(uowCoord, em);
  
                  // Register invocation object to transaction manager for clean up on commit/rollback.
                  registerEmInvocation(uowCoord, txEmInvocation); //d638095.2
  
                  invocationEm = txEmInvocation;
              }
              else
              {
                  // 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).
                  //
                  // 5.9.1 Container Responsibilities
                  // [39] The container may choose to pool EntityManagers and instead of creating and
                  //      closing in each case acquire one from its pool and call clear() on it.
  
                  // For a specific UnitOfWork a new JPANoTxEmInvocation object and
                  // Entity Manager instance will be created.
                  // The invocation objects will be registered with the UOW and held
                  // in a map keyed by the UnitOfWork id so that the same invocation
                  // and entity manager are used for the entire LTC or Activity Session.
                  // Both the invocation object and Entity Manager instance will be pooled
                  // or closed during afterCompletion processing of the UOW.
  
                  JPANoTxEmInvocation noTxEmInvocation = createJPANoTxEmInvocation(uowCoord, em);
  
                  // Register invocation object to transaction manager for clean up on commit/rollback.
                  // Currently registration for local transactions is not Tiered.  This may need to change
                  // if conflicts arise.  //d638095.4
  
                  LocalTransactionCoordinator ltCoord = (LocalTransactionCoordinator) uowCoord;
                  ltCoord.enlistSynchronization(noTxEmInvocation); // F61571
  
                  invocationEm = noTxEmInvocation;
              }
  
              setInvocation(uowSyncRegistry, ivTxKeyPuId, invocationEm); // d683375, d689596
          } else {
              // JPA 2.1: 7.6.4.1 Requirements for Persistence Context Propagation
              // If a component is called and the JTA transaction is propagated into that component:
              //   * 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.
              if (invocationEm.isTxUnsynchronized() && !isTxUnsynchronized()) {
                  Tr.error(tc, "JPATXSYNC_ILLEGAL_PROPAGATION_CWWJP0046E");
                  String msgTxt = "CWWJP0046E: An UNSYNCHRONIZED JPA persistence context cannot be propagated into a SYNCHRONIZED EntityManager.";
                  throw new IllegalStateException(msgTxt);
              }
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              Tr.exit(tc, "getEMInvocationInfo : " + invocationEm);
          return invocationEm;
      }