docs: @Override
      public void deliverOrderedMessages(List msgList,
                                         GuaranteedTargetStream targetStream,
                                         int priority,
                                         Reliability reliability)
  
                      throws SIIncorrectCallException, SINotPossibleInCurrentConfigurationException
      {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.entry(this,
                          tc,
                          "deliverOrderedMessages",
                          new Object[] {
                                        msgList,
                                        targetStream,
                                        new Integer(priority),
                                        reliability });
  
          Exception failingException = null;
          JsDestinationAddress failingDestination = null;
  
          //Create transaction
          TransactionCommon tran = _targetBatchHandler.registerInBatch();
          // A marker to indicate how far through the method we get.
          boolean messageAddCall = false;
          try
          {
              MessageItem msgItem = null;
  
              // Get the end tick of the last message in the list
              msgItem = (MessageItem) msgList.get(msgList.size() - 1);
              long endTick = msgItem.getMessage().getGuaranteedValueEndTick();
  
              // This check is done in case the previous batch rolledback
              // while we were waiting for the batch lock.
              // If this happened then we give up trying to deliver these
              // messages as the previous batch must be redelivered first
              // ( The rollback resets the doubtHorizon to before the
              // failing batch )
              if (targetStream.getDoubtHorizon() > endTick)
              {
                  int lastSuccessfulMsg = -1;
                  long lastSuccessfulEndTick = -1;
                  long currentEndTick = -1;
  
                  // Deliver all messages in list
                  for (int i = 0; i < msgList.size(); i++)
                  {
                      boolean resetRequired = true;
  
                      try
                      {
                          msgItem = (MessageItem) msgList.get(i);
                          currentEndTick = msgItem.getMessage().getGuaranteedValueEndTick();
                          JsDestinationAddress routingDestinationAddr =
                                          msgItem.getMessage().getRoutingDestination();
  
                          // If we find we have a deleted destination, we may need to perform
                          // a move to the system exception destination.
                          String deletedTargetDestination = null;
                          boolean sendToSystemExceptionDestination = false;
  
                          // If this message has a routingDestination we try to deliver the message
                          // there
                          if (routingDestinationAddr != null)
                          {
                              DestinationHandler routingDestination = null;
                              //
                              LinkHandler linkHandler = _isLink ? (LinkHandler) _destination : null;
  
                              try
                              {
                                  // If this has come across a Link then override the
                                  // userId if necessary and reset the link properties as
                                  // we are now pretending this was produced on this ME
                                  if (_isLink)
                                  {
                                      String linkInboundUserid = ((LinkHandler) _destination).getInboundUserid();
                                      if (linkInboundUserid != null)
                                      {
                                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                              SibTr.debug(tc, "Set link inbound userid: " + linkInboundUserid + ", into message");
                                          // Call SIB.security (ultimately) to set inbounduserid into msg
                                          _messageProcessor.getAccessChecker().setSecurityIDInMessage(
                                                                                                      linkInboundUserid,
                                                                                                      msgItem.getMessage());
                                      }
  
                                      msgItem.getMessage().setGuaranteedCrossBusLinkName(null);
                                      msgItem.getMessage().setGuaranteedCrossBusSourceBusUUID(null);
  
                                  }
  
                                  // Find the routing destination.
                                  // For links, we exclude invisible (deleted) destinations, so that
                                  // standard link exception destination handling occurs if we find
                                  // the requested destination doesn't exist, or has been deleted.
                                  // For intra-bus comms, we include invisible (deleted) destinations,
                                  // so that we do not attempt to call the exception destination
                                  // handler with a deleted destination, and we honor the
                                  // discard messages setting on the bus (see below).
                                  routingDestination =
                                                  _destinationManager.getDestination(
                                                                                     routingDestinationAddr,
                                                                                     !_isLink,
                                                                                     true); // create remote temp queue if required
  
                                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                      SibTr.debug(tc, "Routing dest to " + routingDestination);
  
                                  // If this is coming in off a link then use the link's configuration
                                  // to determine if any local message points should be preferred
                                  if (_isLink)
                                  {
                                      msgItem.setPreferLocal(linkHandler.preferLocalTargetQueuePoint());
                                  }
                                  // If it's come from another ME in the bus then they're sending it
                                  // to this message point because they want to so we prefer the local one.
                                  // This allows the mesasge to be re-routed if absolutely necessary.
                                  else
                                      msgItem.setPreferLocal(true);
  
                                  if (_isLink || !routingDestination.isToBeDeleted())
                                  {
                                      // Call the handler to deal with the message
                                      // (If the routing address in the message was used for binding to
                                      // a particular ME then this inputHandler will probably be us)
                                      // (If the routing address in the messages was used for identifying
                                      // a scoped alias then we'll use the alias's input handler to restrict
                                      // the message points available to us, rather than all of them (which is
                                      // what this input handler will have access to - as we're the real destination)
                                      ProducerInputHandler inputHandler;
                                      inputHandler = (ProducerInputHandler) routingDestination.getInputHandler(ProtocolType.UNICASTINPUT, //always unicast
                                                                                                               null, //only needed for anycast, which is not the case here
                                                                                                               msgItem.getMessage());
  
                                      inputHandler.handleMessage(msgItem,
                                                                 tran,
                                                                 _messageProcessor.getMessagingEngineUuid());
                                  }
                                  else
                                  {
                                      // For messages arriving within the bus, we might feasibly find
                                      // the routing destination has been deleted.
                                      // In that case we should honor the discard messages setting on
                                      // the bus and either route to the system exception destination
                                      // or discard the message.
                                      deletedTargetDestination = routingDestination.getName();
                                      sendToSystemExceptionDestination = !_messageProcessor.discardMsgsAfterQueueDeletion();
  
                                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                          SibTr.debug(this, tc, "Message received from within bus for a deleted routing destination " + routingDestination +
                                                                (sendToSystemExceptionDestination ? ". Exceptioning message" : ". Discarding message"));
                                  }
                              } catch (SITemporaryDestinationNotFoundException e)
                              {
                                  // No FFDC code needed
  
                                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                  {
                                      SibTr.exception(tc, e);
                                      SibTr.debug(
                                                  tc,
                                                  "Discarding the message as Temporary destination not found");
                                  }
                              } catch (SIMPNoLocalisationsException e)
                              {
                                  // No FFDC code needed
  
                                  // We can't find a suitable localisation.
                                  // Although a queue must have at least one localisation this is
                                  // possible if the sender restricted the potential localisations
                                  // using a fixed ME or a scoping alias (to an out-of-date set of
                                  // localisation)
  
                                  failingException = e;
                                  failingDestination = routingDestinationAddr;
  
                                  //Put the message to the exception destination
                                  handleUndeliverableMessage(
                                                             routingDestination,
                                                             linkHandler,
                                                             msgItem,
                                                             SIRCConstants.SIRC0026_NO_LOCALISATIONS_FOUND_ERROR,
                                                             new String[] { routingDestination.getName() },
                                                             tran);
                              } catch (SIMPLimitExceededException e)
                              {
                                  // No FFDC code needed
  
                                  // If this is a link and the target destination is unable to accept messages, then we'll attempt
                                  // to put the message to the exception destination that belongs to the link.
  
                                  failingException = e;
                                  failingDestination = routingDestinationAddr;
  
                                  // If the link exception destination is unable to accept the message, or if a null or empty
                                  // exception destination has been configured for the link, then handleUndeliverableMessage() will
                                  // throw an SIResourceException which will result in the message being discarded.
                                  handleUndeliverableMessage(
                                                             null, // set the DH parameter to null, so that we use the LH exception destination
                                                             linkHandler,
                                                             msgItem,
                                                             e.getExceptionReason(), // Extract the exception reason and inserts from the
                                                             e.getExceptionInserts(), // SIMPLimitExceededException exception
                                                             tran);
                              } catch (SIMPSendAllowedException e)
                              {
                                  // No FFDC code needed
  
                                  // If the message came off an interbus link we should exception it (if
                                  // possible) to get it out  of the way to allow other messages to be processed.
                                  if (_isLink)
                                  {
                                      // Putting message to exception destination as the destination is currently unavailable
                                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                      {
                                          SibTr.debug(
                                                      tc,
                                                      "Putting message to exception destination as destination was send-disallowed");
                                          SibTr.exception(tc, e);
                                      }
  
                                      failingException = e;
                                      failingDestination = routingDestinationAddr;
  
                                      // There was nowhere to send the message, send it to the exception
                                      // destination instead
                                      handleUndeliverableMessage(
                                                                 routingDestination,
                                                                 linkHandler,
                                                                 msgItem,
                                                                 e.getExceptionReason(),
                                                                 e.getExceptionInserts(),
                                                                 tran);
                                  }
                                  // If this isn't a link then we have a routing destination because some
                                  // other level of routing restriction has been applied (e.g. scoped Alias or
                                  // fixed ME). If this case we should just rethrow the exception so that the
                                  // stays on the target stream and is retried until it succeeds.
                                  else
                                  {
                                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                          SibTr.debug(
                                                      tc,
                                                      "Failing the message to keep retrying until the queue point becomes send-allowed");
  
                                      SibTr.exception(tc, e);
                                      throw e;
                                  }
                              } catch (SINotPossibleInCurrentConfigurationException e)
                              {
                                  // No FFDC code needed
  
                                  // Putting message to exception destination as the destination is currently unavailable
                                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                  {
                                      SibTr.debug(
                                                  tc,
                                                  "Putting message to exception destination as destination not found");
                                      SibTr.exception(tc, e);
                                  }
  
                                  failingException = e;
                                  failingDestination = routingDestinationAddr;
  
                                  // There was nowhere to send the message, send it to the exception
                                  // destination instead
                                  handleUndeliverableMessage(
                                                             routingDestination,
                                                             linkHandler,
                                                             msgItem,
                                                             e.getExceptionReason(),
                                                             e.getExceptionInserts(),
                                                             tran);
                              } catch (RMQResourceException e)
                              {
                                  // No FFDC code needed
  
                                  // Putting message to exception destination as the destination is currently unavailable
                                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                  {
                                      SibTr.debug(
                                                  tc,
                                                  "Putting message to exception destination as RMQ destination was not available");
                                      SibTr.exception(tc, e);
                                  }
  
                                  failingException = e;
                                  failingDestination = routingDestinationAddr;
  
                                  // There was nowhere to send the message, send it to the exception
                                  // destination instead
                                  handleUndeliverableMessage(
                                                             routingDestination,
                                                             linkHandler,
                                                             msgItem,
                                                             e.getExceptionReason(),
                                                             e.getExceptionInserts(),
                                                             tran);
                              } catch (SIResourceException e)
                              {
                                  // No FFDC code needed
  
                                  // If this is a link and we got a Resource Exception when trying to put the message to the target
                                  // destination, then we'll attempt to put the message to the exception destination that belongs
                                  // to the link.
                                  if (_isLink)
                                  {
                                      // Putting message to link exception destination
                                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                      {
                                          SibTr.debug(tc, "Putting message to link exception destination");
                                          SibTr.exception(tc, e);
                                      }
  
                                      failingException = e;
                                      failingDestination = routingDestinationAddr;
  
                                      handleUndeliverableMessage(
                                                                 null, // set the DH parameter to null, so that we use the LH exc dest
                                                                 linkHandler,
                                                                 msgItem,
                                                                 SIRCConstants.SIRC0026_NO_LOCALISATIONS_FOUND_ERROR,
                                                                 new String[] { routingDestination.getName() },
                                                                 tran);
                                  } // eof _isLink
                                  else
                                  {
                                      // Not a link so re-throw the exception
                                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                          SibTr.debug(
                                                      tc,
                                                      "Failing the message after Resource exception");
  
                                      SibTr.exception(tc, e);
                                      throw e;
                                  }
                              }
  
                          }
                          else
                          {
                              if (!_isLink)
                              {
                                  //Put the message to the inputHandler so that if the local localisation
                                  //is not available, the message can be "sideways-punted" to a different
                                  //localisation
                                  try
                                  {
                                      if (!_destination.isToBeDeleted())
                                      {
                                          InputHandler inputHandler = null;
  
                                          //If the destination is a topicspace and we've been sent a pt-to-pt
                                          //message, then having accepted
                                          //the message, we should publish it.  To do this we must get the
                                          //pub-sub inputhandler for the destination
                                          if (_destination.isPubSub())
                                          {
                                              inputHandler = _destination.getInputHandler();
                                          }
                                          else
                                          {
                                              //Use this inputHandler.
                                              inputHandler = this;
                                          }
  
                                          inputHandler.handleMessage(
                                                                     msgItem,
                                                                     tran,
                                                                     _messageProcessor.getMessagingEngineUuid());
                                      }
                                      else
                                      {
                                          // The destination has been deleted, then we should honor the
                                          // discard messages setting on the bus and either route to the
                                          // system exception destination or discard the message.
                                          deletedTargetDestination = _destination.getName();
                                          sendToSystemExceptionDestination = !_messageProcessor.discardMsgsAfterQueueDeletion();
  
                                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                              SibTr.debug(this, tc, "Message received from within bus for a deleted destination. " +
                                                                    (sendToSystemExceptionDestination ? "Exceptioning message" : "Discarding message"));
                                      }
  
                                  } catch (SIMPNoLocalisationsException e)
                                  {
                                      // No FFDC code needed
  
                                      // We can't find a suitable localisation.
                                      // Although a queue must have at least one localisation this is
                                      // possible if the sender restricted the potential localisations
                                      // using a fixed ME or a scoping alias (to an out-of-date set of
                                      // localisation)
  
                                      //Put the message to the exception destination
                                      handleUndeliverableMessage(
                                                                 _destination,
                                                                 null, // not a link
                                                                 msgItem,
                                                                 SIRCConstants.SIRC0026_NO_LOCALISATIONS_FOUND_ERROR,
                                                                 new String[] { _destination.getName() },
                                                                 tran);
                                  } catch (SIMPSendAllowedException e)
                                  {
                                      // No FFDC code needed
  
                                      // The quee point is current send disallowed, we don't want to
                                      // exception it, instead we leave it 'failing' on the target stream
                                      // so it gets retried periodically (on ackExpected/Nack processing)
                                      // in case the QP is re-enabled.
  
                                      if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                                          SibTr.exception(tc, e);
  
                                      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                                          SibTr.exit(tc, "deliverOrderedMessages", e);
  
                                      throw e;
                                  } catch (SIMPNotPossibleInCurrentConfigurationException e)
                                  {
                                      // No FFDC code needed
  
                                      // There's a problem with the configuration so we can't process this
                                      // message, we better exception it instead.
  
                                      //Put the message to the exception destination
                                      handleUndeliverableMessage(
                                                                 _destination,
                                                                 null, // not a link
                                                                 msgItem,
                                                                 SIRCConstants.SIRC0026_NO_LOCALISATIONS_FOUND_ERROR,
                                                                 new String[] { _destination.getName() },
                                                                 tran);
                                  }
                              }
                              // This is a link but there was no routing destination!!
                              else
                              {
                                  SIErrorException e = new SIErrorException(
                                                  nls.getFormattedMessage(
                                                                          "INTERNAL_MESSAGING_ERROR_CWSIP0001",
                                                                          new Object[] {
                                                                                        "com.ibm.ws.sib.processor.impl.PtoPInputHandler",
                                                                                        "1:2561:1.323" },
                                                                          null));
  
                                  failingException = e;
                                  failingDestination = null;
  
                                  FFDCFilter.processException(
                                                              e,
                                                              "com.ibm.ws.sib.processor.impl.PtoPInputHandler.deliverOrderedMessages",
                                                              "1:2570:1.323",
                                                              this);
  
                                  SibTr.exception(tc, e);
  
                                  if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                                      SibTr.exit(tc, "deliverOrderedMessages", e);
  
                                  throw e;
                              }
                          }
  
                          // If we need to send the message to the system exception destination,
                          // do so here.
                          if (sendToSystemExceptionDestination)
                          {
                              ExceptionDestinationHandlerImpl exceptionDestinationHandlerImpl =
                                              (ExceptionDestinationHandlerImpl) _messageProcessor.createExceptionDestinationHandler(null);
                              final UndeliverableReturnCode rc =
                                              exceptionDestinationHandlerImpl.handleUndeliverableMessage(msgItem,
                                                                                                         tran,
                                                                                                         SIRCConstants.SIRC0032_DESTINATION_DELETED_ERROR,
                                                                                                         new String[] { deletedTargetDestination,
                                                                                                                       _messageProcessor.getMessagingEngineName() });
                              if (rc != UndeliverableReturnCode.OK && rc != UndeliverableReturnCode.DISCARD)
                              {
                                  // We cannot put the message to the exception destination.
                                  // Throw a suitable exception and trace+FFST.
                                  if (rc == UndeliverableReturnCode.BLOCK)
                                  {
                                      SIResourceException e =
                                                      new SIResourceException(nls.getFormattedMessage("INTERNAL_MESSAGING_ERROR_CWSIP0005",
                                                                                                      new Object[] {
                                                                                                                    "com.ibm.ws.sib.processor.impl.PtoPInputHandler",
                                                                                                                    "1:2605:1.323", rc }, null));
  
                                      FFDCFilter.processException(e, "com.ibm.ws.sib.processor.impl.PtoPInputHandler.deliverOrderedMessages",
                                                                  "1:2608:1.323", this);
  
                                      SibTr.exception(tc, e);
  
                                      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                                          SibTr.exit(tc, "deliverOrderedMessages", e);
  
                                      throw e;
                                  }
                                  else
                                  {
                                      SIErrorException e =
                                                      new SIErrorException(nls.getFormattedMessage("INTERNAL_MESSAGING_ERROR_CWSIP0005",
                                                                                                   new Object[] {
                                                                                                                 "com.ibm.ws.sib.processor.impl.PtoPInputHandler",
                                                                                                                 "1:2623:1.323", rc }, null));
  
                                      FFDCFilter.processException(e, "com.ibm.ws.sib.processor.impl.PtoPInputHandler.deliverOrderedMessages",
                                                                  "1:2626:1.323", this);
  
                                      SibTr.exception(tc, e);
  
                                      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                                          SibTr.exit(tc, "deliverOrderedMessages", e);
  
                                      throw e;
                                  }
                              }
                          }
  
                          lastSuccessfulMsg = i;
                          lastSuccessfulEndTick = currentEndTick;
                          resetRequired = false;
                      } catch (SIResourceException e)
                      {
                          // No FFDC code needed
  
                          // We've failed to process a message, we can't carry on with this
                          // list of messages, instead we move the doubt horizon to point to
                          // the failed message so that we don't accidently ack it if someone asks
                          targetStream.resetDoubtHorizon(currentEndTick, failingException, failingDestination);
                          resetRequired = false;
  
                          // then break out of the for loop to allow any successful work to be added
                          // to the batch.
                          break;
                      } finally
                      {
                          // This finally block is to intercept all unexpected errors and clean up.
  
                          // We've failed to process a message, we can't carry on with this
                          // list of messages, instead we move the doubt horizon to point to
                          // the failed message so that we don't accidently ack it if someone asks
                          if (resetRequired)
                              targetStream.resetDoubtHorizon(currentEndTick, failingException, failingDestination);
                      }
                  }
  
                  if (lastSuccessfulMsg != -1)
                  {
                      // We are about to call the messages Added !
                      messageAddCall = true;
  
                      // Now that we have the Batch lock we are free to get the
                      // stream lock and update the pending completedPrefix to the
                      // last successful message delivered
                      targetStream.setNextCompletedPrefix(lastSuccessfulEndTick);
  
                      // Add any messages to the batch.
                      // If this fails the batch will be rolled back and the targetStream
                      // rollback listener will be called which will reset the doubtHorizon
                      // to the start of this list of messages, so we don't want an
                      // SIResourceException to be flowed up the stack.
                      try
                      {
                          _targetBatchHandler.messagesAdded((lastSuccessfulMsg + 1), targetStream);
                      } catch (SIResourceException e)
                      {
                          // No FFDC code needed
  
                          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                              SibTr.exception(tc, e);
                      }
                  }
              }
          } finally
          {
              // Before exiting this method, need to unlock the batch handler if it was locked.
              if (!messageAddCall)
                  try
                  {
                      _targetBatchHandler.messagesAdded(0);
                  } catch (SIResourceException e)
                  {
                      // No FFDC code needed, This will allow for any exceptions that were thrown to
                      // be rethrown instead of overiding with a batch handler error.
                      if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                          SibTr.exception(tc, e);
                  }
              if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                  SibTr.exit(tc, "deliverOrderedMessages", new Boolean(messageAddCall));
  
          }
      }