docs: @Override
      public void beforeDelivery(Method method) throws NoSuchMethodException, ResourceException
      {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
          {
              Tr.entry(tc, "MessageEndpoint.beforeDelivery called for " + method.getName());
          }
  
          //method param for checkState can be null since it's only used when the method is a MDB_BUSINESS_METHOD
          checkState(-1, method, BEFORE_DELIVERY_METHOD);
  
          try
          {
              // f743-7046 start of change.
              // Determine if beforeDelivery was called with an imported TX context.
              // We need to remember this fact in case afterDelivery is called without
              // ever calling a MDB method so that afterDelivery knows whether to
              // abort the TX or not.
              UOWCurrent uowCurrent = EmbeddableTransactionManagerFactory.getUOWCurrent();
              UOWCoordinator inBoundCoord = uowCurrent.getUOWCoord();
              if (inBoundCoord == null)
              {
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  {
                      Tr.debug(tc, "beforeDelivery called without a imported transaction context");
                  }
                  ivImportedTx = false;
              }
              else
              {
                  if (inBoundCoord.isGlobal()) //d174148
                  {
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      {
                          Tr.debug(tc, "beforeDelivery called with a imported transaction context");
                      }
                      ivImportedTx = true;
                  }
                  else
                  {
                      // We have a local transaction, so it can not be a imported transaction.
                      inBoundCoord = null;
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      {
                          Tr.debug(tc, "beforeDelivery called without a imported transaction context");
                      }
                      ivImportedTx = false;
                  }
              }
              // f743-7046 end of change.
  
              // Is this message listener interface that has only 1 method?
              if (ivSingleMethodInterface) //d456256
              {
                  // Yep, then method ID is zero.
                  ivMethodId = 0;
              }
              else
              {
                  // Nope, more than 1 method, so search EJBMethodInfo to get method ID.
                  ivMethodId = getEJBMethodId(method); //d219252
              }
  
              // Now have container start a transaction if necessary
              // and set context class loader.  This is done by performing
              // preinvoke processing for the Method that is going to
              // be invoked by the RA once beforeDelivery processing has
              // completed. So we need to set ivMethodId to the method ID
              // for the method that will be invoked.
              if (ivMethodId < 0)
              {
                  throw new NoSuchMethodException(this.getClass().getName()
                                                  + "." + method.getName()
                                                  + " not found.");
              }
              else
              {
  
                  // Note, the preinvoke returns the MDB instance
                  // to use when the RA invokes a method on the
                  // messaging type interface (MDB method).
                  ivEJSDeployedSupport = new EJSDeployedSupport();
                  try {
                      ivMDB = container.preInvokeMdbActivate(this, ivMethodId, ivEJSDeployedSupport); //LIDB2617.11
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      {
                          Tr.debug(tc, "preinvoke called for MDB method "
                                       + ivMDB.getClass().getName()
                                       + "." + method.getName());
                      }
                  } catch (Throwable t)
                  {
                      container.preinvokeHandleException(t, this, ivMethodId, ivEJSDeployedSupport, super.methodInfos[ivMethodId]);
  
                      // This will never happen since the setUncheckException should
                      // always throw an exception.  But we need this line to make
                      // the compiler happy (it does know exception always thrown).
                      //return null;
                  }
              }
  
              // If we have an XAResource and transaction is not an imported transaction,
              // then enlist the XAResource if preInvoke started a global transaction.
              if ((ivXAResource != null || ivRRSTransactional) && ivImportedTx == false) // d414873  // f743-7046
              {
                  UOWCoordinator coord = uowCurrent.getUOWCoord();
                  if (coord.isGlobal())
                  {
                      int recoveryId;
                      if (ivRecoverableXAResource) //LI2110.68
                      {
                          recoveryId = RecoverableXAResourceAccessor.getXARecoveryToken(ivXAResource);
                      }
                      else
                      {
                          recoveryId = ivRecoveryId;
                      }
  
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) //d174179
                      {
                          Tr.debug(tc, "enlisting XAResource from RA, recovery ID is " + recoveryId);
                      }
                      if (!ivRRSTransactional) {
                          ivTransactionManager.enlist(ivXAResource, recoveryId);
                      } else {
                          XAResource xaResource = container.getEJBRuntime().getRRSXAResource(bmd, coord.getXid());
                          ivTransactionManager.enlist(xaResource, recoveryId);
                      }
                  }
              }
          } catch (Throwable t)
          {
              FFDCFilter.processException(t, CLASS_NAME + ".beforeDelivery", "1244", this);
              throw new ResourceException("beforeDelivery failure", t);
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
          {
              Tr.exit(tc, "MessageEndpoint.beforeDelivery called for " + method.getName());
          }
      }