docs: synchronized public void checkState(int methodId, Method beforeDeliveryMethod, byte invokingMethod)
      {
          // Assertion 3 and 7 checks.
          Thread thread = Thread.currentThread(); // d185161
          if (ivThread != null && ivThread != thread)
          {
              ivDiscardRequired = true;
              // Create an exception to nest in the ISE which will contain stack trace of the conflicting thread
              final Throwable t = new Exception("Conflicting with thread " + ivThread.getId() + ": " + ivThread.getName());
  
              AccessController.doPrivileged(new PrivilegedAction<Void>() {
                  @Override
                  public Void run() {
                      t.setStackTrace(ivThread.getStackTrace());
                      return null;
                  }
              });
  
              throwIllegalStateException("Multiple threads can not use same MessageEndpoint proxy instance concurrently", t);
          }
  
          // Okay, now we know the calling proxy is currently associated with this object.
          // Determine if some other violation of JCA 1.5 spec has occurred.  If so,
          // throw IllegalStateException. Otherwise, make the appropriate state change.
          switch (ivState)
          {
              case (READY_STATE):
                  if (invokingMethod == MDB_BUSINESS_METHOD)
                  {
                      // Resource adapter is using option A delivery.
                      ivState = IN_METHOD_OPTION_A_STATE;
                  }
                  else if (invokingMethod == BEFORE_DELIVERY_METHOD)
                  {
                      // Resource adapter is using option B delivery.
                      ivState = BEFORE_DELIVERY_STATE;
                      ivMethod = beforeDeliveryMethod;
  
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      {
                          Tr.debug(tc, "beforeDelivery: method is " + ivMethod);
                      }
                  }
                  else if (invokingMethod == RELEASE_METHOD)
                  {
                      // Resource adapter is releasing use of the endpoint proxy.
                      ivState = RELEASED_STATE;
                  }
                  else
                  {
                      // Assertion 5 was violated since this state indicates all prior
                      // beforeDelivery calls were already paired with a matching
                      // afterDelivery call. So we have an unmatched afterDelivery call.
                      ivDiscardRequired = true;
                      throwIllegalStateException("afterDelivery not paired with a prior beforeDelivery call"); // d185161
                  }
                  break;
  
              case (IN_METHOD_OPTION_A_STATE):
                  // Assertion 2 and 3 was violated since this state indicates a prior
                  // MDB method was invoked by this object and this object is waiting
                  // for the MDB method to return.
                  ivDiscardRequired = true;
                  throwIllegalStateException("JCA requires resource adapter to ensure serial use of endpoint"); // d185161
  
              case (BEFORE_DELIVERY_STATE):
                  if (invokingMethod == MDB_BUSINESS_METHOD)
                  {
                      // Get EJBMethodInfoImpl object for the MDB method being invoked.
                      EJBMethodInfoImpl methodInfo = super.methodInfos[methodId];
  
                      if (!(methodInfo.methodsMatch(ivMethod)))
                      {
                          // Assertion 4 violated.
                          ivDiscardRequired = true;
                          throwIllegalStateException("JCA requires resource adapter to invoke same method that was passed to beforeDelivery"); //d174179
                      }
  
                      ivState = IN_METHOD_OPTION_B_STATE;
                  }
                  else if (invokingMethod == AFTER_DELIVERY_METHOD)
                  {
                      // ivState = READY_STATE;
  
                      // f743-7046 start
                      // For JCA 1.5, continue to commit the TX if the RA invokes
                      // beforeDelivery followed by afterDelivery without ever invoking
                      // a message listener interface method to deliver the message.
                      // This ensures same behavior for JCA 1.5 RA that has always
                      // occurred since WAS 6.0.  For JCA 1.6 and later, set the ivRollbackOnly
                      // flag to force new behavior of aborting the TX by doing a rollback.
                      if (majorJCAVersion == 1 && minorJCAVersion == 5) {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                              Tr.debug(tc, "MessageEndpoint.afterDelivery is committing TX for JCA version 1.5 RA. "
                                           + "A message listener method was not called in between the before/afterDelivery methods.");
                          }
                          ivRollbackOnly = false;
                      }
                      else
                      {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                          {
                              Tr.debug(tc, "MessageEndpoint.afterDelivery aborting TX as required by " + majorJCAVersion + "." + minorJCAVersion
                                           + ".  A message listener method was not called in between the before/afterDelivery methods.");
                          }
                          // Only abort TX if it is NOT an imported TX.
                          ivRollbackOnly = (ivImportedTx == false);
                      }
                      // f743-7046 end
                  }
                  else if (invokingMethod == BEFORE_DELIVERY_METHOD)
                  {
                      // Assertion 5 violation - 2 consecutive beforeDelivery calls.
                      ivDiscardRequired = true;
                      throwIllegalStateException("JCA requires resource adapter to call afterDelivery before the beforeDelivery can be called again on this endpoint"); // d185161
                  }
                  else
                  {
                      // d192893
                      // Assertion 5 - release called after beforeDelivery in Option B requires the
                      // application server to abort transaction started by beforeDelivery method.
                      // So do not throw IllegalStateException at this time.  Instead, allow release
                      // method to be invoked so that it aborts the transaction.  Note, since the
                      // start of this method ensured release is called from the same thread that
                      // called beforeDelivery, we know it is okay to abort the transaction.
                      ivState = RELEASED_STATE;
                  }
                  break;
  
              case (IN_METHOD_OPTION_B_STATE):
                  // Assertion 2 and 3 was violated since this state indicates a prior
                  // MDB method was invoked by this object and this object is waiting
                  // for the MDB method to return.
                  if (invokingMethod == MDB_BUSINESS_METHOD)
                  {
                      ivDiscardRequired = true;
                      throwIllegalStateException("beforeDelivery called twice without afterDelivery between calls"); //d174179
                  }
                  else if (invokingMethod == AFTER_DELIVERY_METHOD)
                  {
                      ivDiscardRequired = true;
                      throwIllegalStateException("beforeDelivery called twice without afterDelivery between calls");
                  }
                  else if (invokingMethod == BEFORE_DELIVERY_METHOD)
                  {
                      ivDiscardRequired = true;
                      throwIllegalStateException("beforeDelivery called twice without afterDelivery between calls"); // d185161
                  }
                  else
                  {
                      ivDiscardRequired = true;
                      throwIllegalStateException("release called without a prior afterDelivery call"); //d174179
                  }
  
              case (AFTER_DELIVERY_PENDING_STATE):
                  if (invokingMethod == AFTER_DELIVERY_METHOD)
                  {
                      // Let afterDelivery method complete transaction.
                  }
                  else if (invokingMethod == MDB_BUSINESS_METHOD)
                  {
                      // Assertion 6 violation - only 1 message delivery allowed per
                      // pair of beforeDelivery/afterDelivery calls.
                      ivDiscardRequired = true;
                      throwIllegalStateException("JCA requires resource adapter to ensure 1 message delivery per pair of before/after delivery calls."); //174179
                  }
                  else if (invokingMethod == BEFORE_DELIVERY_METHOD)
                  {
                      // Assertion 5 violation - beforeDelivery/afterDelivery must come in pairs.
                      ivDiscardRequired = true;
                      throwIllegalStateException("JCA requires resource adapter to call afterDelivery before another beforeDelivery call can be made."); // d185161
                  }
                  else
                  {
                      // d192893
                      // Assertion 5 - release called after beforeDelivery in Option B requires the
                      // application server to abort transaction started by beforeDelivery method.
                      // So do not throw IllegalStateException at this time.  Instead, allow release
                      // method to be invoked so that it aborts the transaction.  Note, since the
                      // start of this method ensured release is called from the same thread that
                      // called beforeDelivery, we know it is okay to abort the transaction.
                      ivState = RELEASED_STATE;
                  }
                  break;
  
              case (RELEASED_STATE):
              case (DISCARDED_STATE):
              default:
                  // Assertion 1 violation.
                  ivDiscardRequired = true;
                  throwIllegalStateException("JCA requires resource adapter not to make any calls on endpoint once release is called on endpoint");
  
          }
  
          // If IllegalStateException did not occur, remember
          // what Thread instance is currently using this proxy.
          ivThread = thread;
      }