docs: private SIMPMessage getEligibleMsgLocked(TransactionCommon tranImpl) throws SIResourceException
      {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.entry(tc, "getEligibleMsgLocked", new Object[] { this, tranImpl });
  
          /*
           * 166829.1 Support for noLocal delivery
           * 
           * If we are pubsub and noLocal has been specified we should not deliver the message
           * to this consumer if it was published on the same connection. We cannot do this at
           * fanout stage since we do not know the current connection until delivery time.
           * 
           * On delivery we need to iterate through the itemstream until we find an eligible
           * message (i.e. not from this connection). For each message that does not comply, we
           * mark it for deletion. If we find a message, we deliver and delete the marked messages
           * under the given transaction.
           * If we do not find a message, we create a transaction and delete all the marked messages.
           */
  
          SIMPMessage msg = null;
  
          // Before we try to lock a message we need to know that this consumer or its
          // ConsumerSet will allow it (they haven't reached their maxActiveMessage limits).
          // If they will accept it we have to, in th case of a ConsumerSet, 'reserve' the
          // space upfront because multiple members of the set could be concurrently adding
          // active messages. If this add happens to take the last available slot in the set's
          // quota it will keep the set write-locked for the duration of the message lookup. During
          // this time no other consumers in the set will be able to add any more messages.
          // This is done to ensure that the set's suspend/resume state is consistent and we don't
          // have to un-suspend consumers when we find there isn't a message on the queue
          // after all.
          boolean msgAccepted = prepareAddActiveMessage();
          if (!msgAccepted)
          {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  SibTr.debug(tc, "The consumer (or its set) is currently maxed out");
          }
          else
          {
              // We do the following in a try so that we're guaranteed to release any activeMessage
              // lock that we may hold (in JSConsumerSet.addActiveMessage())
              try
              {
                  // Retrieve the next message on the itemstream
                  msg = retrieveMsgLocked();
  
                  // If noLocal is set, then we check if this message came from the same connection.
                  // If so, we mark it for deletion.
                  if (msg != null && _consumerDispatcher.getConsumerDispatcherState().isNoLocal())
                  {
                      LinkedList<SIMPMessage> markedForDeletion = new LinkedList<SIMPMessage>();
                      int msgCount = 0;
                      while (msg != null && _connectionUuid.equals(msg.getProducerConnectionUuid()))
                      {
                          markedForDeletion.add(msg);
                          msgCount++;
                          if (msgCount >= NO_LOCAL_BATCH_SIZE)
                          {
                              removeUnwantedMsgs(markedForDeletion, null);
                              markedForDeletion.clear();
                              msgCount = 0;
                          }
                          // If we weren't looking for a particular message then we can just lock the
                          // next available one.
                          msg = retrieveMsgLocked();
                      }
  
                      // If any messages were marked for deletion, then delete them.
                      if (!markedForDeletion.isEmpty())
                      {
                          //If we reached the end of the itemstream (and therefore have a null message) then
                          //we need to create our own transaction under which to delete the marked messages. If
                          //not, we have a message and we deliver and delete under the given transaction.
                          TransactionCommon tran = null;
                          if (tranImpl != null && msg != null)
                              tran = tranImpl;
  
                          removeUnwantedMsgs(markedForDeletion, tran);
                      }
                  }
              } finally
              {
                  // If a message was locked we commit the adding of it to the maxActiveMessage
                  // quotas
                  if (msg != null)
                      commitAddActiveMessage();
                  // If no message was there then we rollback the prepared add that we did above.
                  else
                      rollbackAddActiveMessage();
              }
          } // msgAccepted
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.exit(tc, "getEligibleMsgLocked", msg);
  
          return msg;
      }