code: private void checkReceiveState()
                      throws SIIncorrectCallException, SISessionUnavailableException
      {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.entry(tc, "checkReceiveState");
  
          // Only valid if the consumer session is still open
          checkNotClosed();
  
          //if there is an AsynchConsumerCallback registered, throw an exception
          if (_asynchConsumerRegistered)
          {
              if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                  SibTr.exit(tc, "checkReceiveState", "asynchConsumerRegistered == true ");
  
              throw new SIIncorrectCallException(
                              nls.getFormattedMessage(
                                                      "RECEIVE_USAGE_ERROR_CWSIP0171",
                                                      new Object[] { _consumerDispatcher.getDestination().getName(),
                                                                    _messageProcessor.getMessagingEngineName() },
                                                      null));
          }
          // If we already have the waiting bit set it implies another
          // thread is sat waiting in a receive for this consumer (we release
          // the consumer lock while waiting so this is possible).
          else if (_waiting)
          {
              SIIncorrectCallException e =
                              new SIIncorrectCallException(
                                              nls.getFormattedMessage(
                                                                      "RECEIVE_USAGE_ERROR_CWSIP0178",
                                                                      new Object[] { _consumerDispatcher.getDestination().getName(),
                                                                                    _messageProcessor.getMessagingEngineName() },
                                                                      null));
  
              if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                  SibTr.exit(tc, "checkReceiveState", "receive already in progress");
  
              throw e;
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.exit(tc, "checkReceiveState");
      }
docs: Checks the state for the synchronous consumer
  
  Will check for not closed,
  AsynchConsumer
  and if it is already in a wait
  
  If any of those conditions appear - an exception will be thrown.