docs: private boolean attachAndLockMsg(SIMPMessage msgItem, boolean isOnItemStream)
                      throws SIResourceException
      {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.entry(
                          tc,
                          "attachAndLockMsg",
                          new Object[] { msgItem, Boolean.valueOf(isOnItemStream), this });
  
          // If we're attaching a message and we already have one something's gone really bad.
          // It's too late to stop it so all we can do is issue an FFDC so that when they
          // finally spot a message is stuck in locked state we can see why (although how we
          // got here is still unknown).
          if (_msgAttached)
          {
              String text = "Message already attached [";
  
              if (_attachedMessage != null)
                  text = text + _attachedMessage.getMessage().getMessageHandle();
  
              text = text + "," + msgItem.getMessage().getMessageHandle() + "]";
  
              SIErrorException e = new SIErrorException(text);
  
              FFDCFilter.processException(
                                          e,
                                          "com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.attachAndLockMsg",
                                          "1:1057:1.22.5.1",
                                          this);
          }
  
          // If the message is in the Message Store we need to remember the MS ID
          // of this message so that we can retrieve it by ID later
          if (isOnItemStream)
          {
              // If the consumer is a forward scanning consumer then it has to
              // use the MS cursor to find the message (this message may be behind
              // the cursor) so we don't lock it here
              if (_consumerSession.getForwardScanning())
              {
                  _msgLocked = false; // We can't lock a message for a FS consumer
                  _msgAttached = true;
                  _msgOnItemStream = true; // But it is on the itemstream
                  _attachedMessage = null; // Let the consumer find the actual message
              }
              // Otherwise the consumer can go directly to the message
              else
              {
                  // Determine which cursor to use
                  LockingCursor cursor = _consumerKey.getGetCursor(msgItem);
                  // We need to lock the message here so that another consumer does
                  // not snatch it after we tell the CD that we'll take it, if it did
                  // it could potentially result in this consumer being unsatisfied
                  // even when there was a matching message available
                  try
                  {
                      _msgLocked = msgItem.lockItemIfAvailable(cursor.getLockID());
                  } catch (MessageStoreException e)
                  {
                      // FFDC
                      FFDCFilter.processException(
                                                  e,
                                                  "com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.attachAndLockMsg",
                                                  "1:1094:1.22.5.1",
                                                  this);
  
                      SibTr.exception(tc, e);
  
                      _msgLocked = false;
                      _msgAttached = true;
                      _msgOnItemStream = true;
                      _attachedMessage = null;
  
                      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                          SibTr.exit(tc, "attachAndLockMsg", e);
  
                      throw new SIResourceException(e);
                  }
  
                  if (_msgLocked)
                  {
                      _msgAttached = true;
                      _msgOnItemStream = true;
                      _attachedMessage = msgItem;
                  }
                  // If we fail to lock it then someone else must have got in there before
                  // us. But because we've already removed this consumer from the ready list
                  // we're going to have to follow through and wake up the consumer so that
                  // they go round the loop of making themselves ready, checking the queue
                  // for messages, and waiting. Otherwise we could miss a message that was
                  // put on the queue while we weren't ready.
                  else
                  {
                      // We set the strange combination of _msgAttached and _msgOnItemStream
                      // (but not _msgLocked) so that we force the consumer to check the queue
                      // for more messages before continueing (see getAttachedMessage).
                      _msgAttached = true;
                      _msgOnItemStream = true;
                      _attachedMessage = null;
  
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                          SibTr.debug(tc, "Missed the message!");
                  }
              }
          }
          // We locked the message (if it was never on the itemStream we've sort of
          // locked it by default).
          else
          {
              _msgLocked = false;
              _msgAttached = true;
              _msgOnItemStream = false;
              _attachedMessage = msgItem;
          }
  
          // If we are a member of a key group we must make the group aware that a
          // message has been attached to one of its members
          if (_msgAttached && (_keyGroup != null))
              _keyGroup.attachMessage(_consumerKey);
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.exit(tc, "attachAndLockMsg", Boolean.valueOf(_attachedMessage != null));
  
          return (_attachedMessage != null);
      }