Copy the message to the exception destination
@param tran can be null
@throws SIResourceException
@throws SINotPossibleInCurrentConfigurationException
966075
public void copyMessageToExceptionDestination(LocalTransaction tran) 
  throws SINotPossibleInCurrentConfigurationException, SIResourceException
  
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "copyMessageToExceptionDestination", tran);
    
    SIMPMessage msg = getSIMPMessage();
    ExceptionDestinationHandlerImpl edh = null;
    
    if (_destinationHandler.isLink())
      edh = new ExceptionDestinationHandlerImpl(_destinationHandler);
    else {
      edh = new ExceptionDestinationHandlerImpl(null, _messageProcessor);
      edh.setDestination(_destinationHandler);
    }
    edh.sendToExceptionDestination(
        msg.getMessage(),
        null,
        tran,
        SIRCConstants.SIRC0036_MESSAGE_ADMINISTRATIVELY_REROUTED_TO_EXCEPTION_DESTINATION,
        null,
        new String[]{""+_messageID,
                     _destinationHandler.getName(),
                     _messageProcessor.getMessagingEngineName()});
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "copyMessageToExceptionDestination");    
  }
1348478
public synchronized void newGuessInStream(long tick) throws SIResourceException
  {

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "newGuessInStream", new Object[] { Long.valueOf(tick),
          Boolean.valueOf(containsGuesses),
          Long.valueOf(sendWindow),
          Long.valueOf(totalMessages),
          Long.valueOf(firstMsgOutsideWindow)});
    
    // If this is the first guess in the stream 
    if( !containsGuesses)
    { 
      containsGuesses=true;  
      if( sendWindow > totalMessages )
      {
        sendWindow = totalMessages;
        persistSendWindow(sendWindow, null);  
        firstMsgOutsideWindow = tick; 
      }  
    }
         
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "newGuessInStream", new Object[] {Boolean.valueOf(containsGuesses),
          Long.valueOf(sendWindow),
          Long.valueOf(firstMsgOutsideWindow)});
  }
997019
public SIBusMessage peek() 
  
  throws SISessionUnavailableException, SIResourceException, SIIncorrectCallException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "peek");
    
    checkValidState("peek");
    
    _localConsumerPoint.checkNotClosed();

    SIBusMessage nextMessage = null;
    
    if(!_seenSingleMessage)
    {
      // Because this message is not in the message store there is no need to copy it
      // before giving it to a caller unless this is pubsub, in which case there may be
      // other subscriptions referencing the same message, in which case we must copy the
      // message (unless the caller indicates that they won't be altering it)
      if(_isPubsub &&
         ((ConnectionImpl)(_localConsumerPoint.getConsumerSession().getConnection())).getMessageCopiedWhenReceived())
      {
        try
        {
          nextMessage = (_singleMessage.getMessage()).getReceived();
        }
        catch (MessageCopyFailedException e)
        {
          FFDCFilter.processException(
            e,
            "com.ibm.ws.sib.processor.impl.SingleLockedMessageEnumerationImpl.peek",
            "1:456:1.44",
            this);
              
          SibTr.exception(tc, e);
          SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
            new Object[] {
              "com.ibm.ws.sib.processor.impl.SingleLockedMessageEnumerationImpl",
              "1:463:1.44",
              e });
            
          _seenSingleMessage = false;
          _messageAvailable = false;
    
          if (TraceComponent.isAnyTracingEnabled() && CoreSPILockedMessageEnumeration.tc.isEntryEnabled())
            SibTr.exit(CoreSPILockedMessageEnumeration.tc, "peek", e);
    
          throw new SIResourceException(
            nls.getFormattedMessage(
              "INTERNAL_MESSAGING_ERROR_CWSIP0002",
              new Object[] {
                "com.ibm.ws.sib.processor.impl.SingleLockedMessageEnumerationImpl",
                "1:477:1.44",
                e },
              null),
            e);
        }
      }
      else
        nextMessage = _singleMessage.getMessage();
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "peek", nextMessage);
    return nextMessage;
  }
1005783
@Override
    public void setTargetTransport(String newTargetTransport) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setTargetTransport", newTargetTransport);
        jcaManagedConnectionFactory.setTargetTransport(newTargetTransport);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setTargetTransport");
    }
1153363
public static void copy(InputStream source, OutputStream destination) throws IOException
    {
        Check.notNull(source);
        Check.notNull(destination);

        final byte[] buffer = new byte[BUFFER_COPY];
        while (true)
        {
            final int read = source.read(buffer);
            if (read == -1)
            {
                break;
            }
            destination.write(buffer, 0, read);
        }
    }
643513
public void put(List undeliveredMessages, boolean isRestoring) throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this,tc, "put", undeliveredMessages);
    int length = undeliveredMessages.size();

    // read the RemoteQPConsumerKey for later on updating the prefetching stuff.
    // need to do this before adding to item stream since spilling will wipe out this data
    // and there is no guarantee how soon that could occur.
    RemoteQPConsumerKey[] rcks = new RemoteQPConsumerKey[length];

    // add them all in one transaction
    LocalTransaction tran = null;
    try
    {
      tran = _tranManager.createLocalTransaction(true);
      for (int i=0; i<length; i++)
      {
        AIMessageItem msg = (AIMessageItem) undeliveredMessages.get(i);
        RemoteDispatchableKey dkey = msg.getAIStreamKey().getRemoteDispatchableKey();
        if (dkey instanceof RemoteQPConsumerKey)
          rcks[i] = (RemoteQPConsumerKey) dkey;

        itemStream.addItem(msg, (Transaction) tran);
        registerForEvents(msg);

        // Identify the fact that the message originated on a remote queue point
        // in order for consumer key groups to find the correct getCursor later on
        msg.setLocalisingME(getLocalisationUuid());
      }
      tran.commit();
    }
    catch (Exception e)
    {
      // log error
      FFDCFilter.processException(e,
        "com.ibm.ws.sib.processor.impl.RemoteConsumerDispatcher.put","1:708:1.97.2.21",this);
      SibTr.exception(tc, e);

      if (tran != null)
      {
        try
        {
          tran.rollback();
        }
        catch (Exception e2)
        {
          // log error
          FFDCFilter.processException(e2,
            "com.ibm.ws.sib.processor.impl.RemoteConsumerDispatcher.put","1:721:1.97.2.21",this);
          SibTr.exception(tc, e2);
        }
      }

      if (!isRestoring)
      {
        // tell the consumers, since ordering may be violated. A consumer that wants ordering guarantees
        // should detach and reattach
        SIIncorrectCallException e3 = new SIIncorrectCallException(
          nls.getFormattedMessage("PUTEXCEPTION_DISCONNECT_CONSUMER_CWSIP0473",
                                  new Object[]{getDestName(), getLocalisationUuid().toString(), e},
                                  null));
        dispatchExceptionToConsumers(e3);
  
        // reject the messages and also notify the waiting ConsumerKey
        for (int i=0; i<length; i++)
        {
          AIMessageItem msg = (AIMessageItem) undeliveredMessages.get(i);
          AIStreamKey key = msg.getAIStreamKey();
          _aih.reject(key);
          resolve(key); // Resolve so that we re-request a msg and dont forget about the request that just failed
        }
      }
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
        SibTr.exit(tc, "put", e);
      return;

    }
    
    // successfully added to itemStream
    for (int i=0; i<length; i++)
    {
      AIMessageItem msg = (AIMessageItem) undeliveredMessages.get(i);

      if (msg.isReserved())
        msg.restoreAOData(lockID);
        
      // If the above failed then we may no longer be reserved
      if (!msg.isReserved())
      {
        // update prefetching stuff
        if (rcks[i] != null)
          rcks[i].messageReceived(msg.getAIStreamKey());
  
        // call dispatchInternal()
        dispatchInternalAndHandleException(msg);
      }
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "put");
  }
19766
protected void createTransmissionDestination(SIBUuid8 remoteMEUuid) throws SIResourceException, SIMPDestinationAlreadyExistsException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "createTransmissionDestination", remoteMEUuid);
        String destinationName = remoteMEUuid.toString();
        DestinationDefinition destinationDefinition;

        destinationDefinition = messageProcessor.createDestinationDefinition(DestinationType.QUEUE, destinationName);
        destinationDefinition.setMaxReliability(Reliability.ASSURED_PERSISTENT);
        destinationDefinition.setDefaultReliability(Reliability.ASSURED_PERSISTENT);
        Set<String> destinationLocalizingSet = new HashSet<String>();
        destinationLocalizingSet.add(messageProcessor.getMessagingEngineUuid().toString());

        // Create the transmission destination
        createDestinationLocalization(
                                      destinationDefinition,
                                      messageProcessor.createLocalizationDefinition(destinationDefinition.getName()),
                                      destinationLocalizingSet,
                                      false);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "createTransmissionDestination");
    }
1255656
public void copy(ConnectionContext source) {
        this.connection = source.connection;
        this.session = source.session;
        this.destination = source.destination;
    }
531025
public void messageEventOccurred(int event,
                                   SIMPMessage msg,
                                   TransactionCommon tran) throws SIResourceException 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "messageEventOccurred", new Object[]{new Integer(event),msg,tran});

    if(event == MessageEvents.POST_COMMITTED_TRANSACTION)
    {
      eventPostCommit(msg);
    }
    else if(event == MessageEvents.POST_COMMIT_ADD)
    {
      eventPostAdd(msg, tran, false);
    }
    else if(event == MessageEvents.POST_ROLLBACK_ADD)
    {
      eventPostAdd(msg, tran, true);
    }
    else
    {
      SIErrorException e = new SIErrorException(
        nls.getFormattedMessage(
          "INTERNAL_MESSAGING_ERROR_CWSIP0001",
          new Object[] {
            "com.ibm.ws.sib.processor.impl.PtoPOutputHandler",
            "1:1275:1.241" },
          null));

      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.PtoPOutputHandler.messageEventOccurred",
        "1:1281:1.241",
        this);

      SibTr.exception(tc, e);
      SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
        new Object[] {
          "com.ibm.ws.sib.processor.impl.PtoPOutputHandler",
          "1:1288:1.241" });

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "messageEventOccurred", e);

      throw e;
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "messageEventOccurred");
  }
834614
@Override
    public void sendToExceptionDestination(
                                           SIDestinationAddress address,
                                           SIBusMessage message,
                                           int reason,
                                           String[] inserts,
                                           SITransaction tran,
                                           String alternateUser)
                    throws SIResourceException, SIConnectionLostException, SILimitExceededException,
                    SIErrorException,
                    SINotAuthorizedException,
                    SIIncorrectCallException,
                    SINotPossibleInCurrentConfigurationException
    {
        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.entry(CoreSPIConnection.tc, "sendToExceptionDestination",
                        new Object[] { this, address, alternateUser, message, Integer.valueOf(reason), inserts, tran });

        if (message == null)
        {
            if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
                SibTr.exit(CoreSPIConnection.tc, "sendToExceptionDestination", "SIIncorrectCallException - null msg");
            throw new SIIncorrectCallException(
                            nls_cwsir.getFormattedMessage(
                                                          "SEND_EXCEPTION_DEST_CWSIR0121",
                                                          null,
                                                          null));
        }

        // Get an exception destination instance
        ExceptionDestinationHandlerImpl exDestHandler =
                        new ExceptionDestinationHandlerImpl(address, _messageProcessor);

        exDestHandler.sendToExceptionDestination(message,
                                                 alternateUser,
                                                 (TransactionCommon) tran,
                                                 reason,
                                                 this,
                                                 inserts);

        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.exit(CoreSPIConnection.tc, "sendToExceptionDestination");
    }
23824
public void reconstitute(BaseDestinationHandler destinationHandler) throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "reconstitute", destinationHandler); 

    super.reconstitute(destinationHandler);
      
    _destHighMsgs = destinationHandler.getMessageProcessor().getHighMessageThreshold();

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
    {
      SibTr.exit(tc, "reconstitute");           
    }
  }
48951
public void reconstitute(BaseDestinationHandler destinationHandler)
  throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "reconstitute", destinationHandler); 
      
    initializeNonPersistent(destinationHandler);
    
    // If message depth intervals are configured, set the MsgStore watermarks
    // accordinly (510343)
    setDestMsgInterval();

    try
    {
      // F001338-55330
      // getStatistics() inturn will load all the metadata related to the
      // destination.With the introduction of the feature F001338-55330 this
      // will benefit the ME start up time
      Statistics statistics = getStatistics();
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "reconstitute - counts total items, available items",
            new Object[] { new Long(statistics.getTotalItemCount()), new Long(statistics.getAvailableItemCount()) });
    }
    catch (MessageStoreException e)
    {
      // No FFDC code needed
      SibTr.exit(tc, "reconstitute", e);
    }     
    
  }
220321
@Override
    public void messageEventOccurred(
                                     int event,
                                     SIMPMessage msg,
                                     TransactionCommon tran)
                    throws SIRollbackException,
                    SIConnectionLostException,
                    SIIncorrectCallException,
                    SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "messageEventOccurred",
                        new Object[] { Integer.valueOf(event), msg, tran });

        if (event == MessageEvents.REFERENCES_DROPPED_TO_ZERO)
        {
            _pubSubRealization.itemReferencesDroppedToZero(msg);
        }
        else if (event == MessageEvents.EXPIRY_NOTIFICATION)
        {
            eventMessageExpiryNotification(msg, tran);
        }
        else if (event == MessageEvents.COD_CALLBACK) //183715.1
        {
            sendCODMessage(msg, tran);
        }
        else
        {
            final SIErrorException e =
                            new SIErrorException(
                                            nls.getFormattedMessage(
                                                                    "INTERNAL_MESSAGING_ERROR_CWSIP0001",
                                                                    new Object[] {
                                                                                  "com.ibm.ws.sib.processor.impl.BaseDestinationHandler",
                                                                                  "1:3717:1.700.3.45" },
                                                                    null));

            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.BaseDestinationHandler.messageEventOccurred",
                                        "1:3723:1.700.3.45",
                                        this);

            SibTr.exception(tc, e);

            SibTr.error(
                        tc,
                        "INTERNAL_MESSAGING_ERROR_CWSIP0001",
                        new Object[] {
                                      "com.ibm.ws.sib.processor.impl.BaseDestinationHandler",
                                      "1:3733:1.700.3.45" });

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "messageEventOccurred", e);

            throw e;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "messageEventOccurred");
    }
201037
protected void eventPreUnlocked(SIMPMessage msg, TransactionCommon tran)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "eventPreUnlocked", new Object[] { msg, msg.guessRedeliveredCount() });

        /*
         * 166955.4
         * Check whether the retryCount has been exceeded. If it has then this is a poison msg
         * and needs to be sent to the exception destination rather than to a valid consumer
         * again
         */
        // But only check for messages that are not persistently locked (messages involved in RemoteGet)
        // Otherwise the remote get protocols dont work

        if ((msg.guessRedeliveredCount() + 1) >= _baseDestHandler.getMaxFailedDeliveries())
        {
            /*
             * Message has been delivered a greater number of times than allowed.
             * Route message on to the exception destination associated with this
             * destination.
             */

            // Deregister rollback callbacks to avoid recursive event callbacks
            msg.deregisterMessageEventListener(MessageEvents.POST_ROLLBACK_REMOVE, this);
            msg.deregisterMessageEventListener(MessageEvents.POST_ROLLBACK_ADD, this);

            UndeliverableReturnCode rc = null;
            try
            {
                if (_isPubSub)
                {
                    // F001333-14610
                    // Pass the subscription ID to the destination handler
                    // so that it can be set on the exceptioned message.
                    rc = _baseDestHandler.handleUndeliverableMessage(msg,
                                                                     SIRCConstants.SIRC0035_BACKOUT_THRESHOLD_ERROR,
                                                                     new String[] { _baseDestHandler.getName(),
                                                                                   _messageProcessor.getMessagingEngineName() },
                                                                     tran,
                                                                     dispatcherState.getSubscriberID());
                }
                else
                {
                    // Not pub sub so no subscription ID to pass
                    rc = _baseDestHandler.handleUndeliverableMessage(msg,
                                                                     SIRCConstants.SIRC0035_BACKOUT_THRESHOLD_ERROR,
                                                                     new String[] { _baseDestHandler.getName(),
                                                                                   _messageProcessor.getMessagingEngineName() },
                                                                     tran);
                }
            } catch (SIResourceException e)
            {
                // No FFDC code needed
                // Exception had already been handled
            }

            // re-register the callbacks
            msg.registerMessageEventListener(MessageEvents.POST_ROLLBACK_REMOVE, this);
            msg.registerMessageEventListener(MessageEvents.POST_ROLLBACK_ADD, this);

            if (rc == null || rc == UndeliverableReturnCode.ERROR)
            {
                // Spin of a new alarm
                _messageProcessor.getAlarmManager().
                                create(SIMPConstants.EXCEPTION_RETRY_TIMEOUT,
                                       new ExceptionDestinationRetryHandler(msg, this));
            }

            if (rc == UndeliverableReturnCode.BLOCK)
            {
                // PK03344 - Handle retry count when no exception destination available
                // When the retry count is reached and we have nowhere to send the message
                // we suspend the consumer for a period of time to avoid 100% cpu usage
                // due to continuous message retry.

                // MDBs will only have one consumer (PK03344 handles the MDB case).
                // For multiple consumers we suspend them all.

                // Pause the consumers for the specified time
                pauseConsumers(msg, _baseDestHandler.getBlockedRetryInterval());
            }

            if (rc != UndeliverableReturnCode.BLOCK)
                msg.setRedeliveryCountReached();

        } // End of 165955.4

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "eventPreUnlocked");
    }
54083
@Override
    public void sendAckExpectedMessage(
                                       long ackExpStamp,
                                       int priority,
                                       Reliability reliability,
                                       SIBUuid12 stream)
                    throws SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "sendAckExpectedMessage",
                        new Object[] { new Long(ackExpStamp), new Integer(priority), reliability, stream });
        HashMap allPubSubOutputHandlers = _destination.getAllPubSubOutputHandlers();
        try
        {
            Iterator itr = allPubSubOutputHandlers.values().iterator();

            while (itr.hasNext())
            {
                PubSubOutputHandler handler = (PubSubOutputHandler) itr.next();

                // Send AckExpected to all OutputHandlers
                handler.processAckExpected(ackExpStamp, priority, reliability, stream);
            }
        } finally
        {
            // By calling the getAllPubSubOutputHandlers it will lock the 
            // handlers
            _destination.unlockPubsubOutputHandlers();
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "sendAckExpectedMessage");
    }
1230195
public DestinationDefinition createSystemDefaultExceptionDestination()
                    throws SIResourceException, SIMPDestinationAlreadyExistsException {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.entry(tc, "createSystemDefaultExceptionDestination");

        // Set up a suitable definition
        DestinationDefinition defaultExceptionDestDef = createDestinationDefinition(
                                                                                    DestinationType.QUEUE,
                                                                                    SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION
                                                                                                    + getMessagingEngineName());

        // Set up a suitable qos
        defaultExceptionDestDef
                        .setMaxReliability(Reliability.ASSURED_PERSISTENT);
        defaultExceptionDestDef
                        .setDefaultReliability(Reliability.ASSURED_PERSISTENT);
        defaultExceptionDestDef
                        .setUUID(SIMPUtils
                                        .createSIBUuid12(SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION
                                                         + getMessagingEngineName()));

        // Destination is localized on this ME
        Set<String> destinationLocalizingMEs = new HashSet<String>();
        destinationLocalizingMEs.add(getMessagingEngineUuid().toString());

        // Create the destination
        _destinationManager
                        .createDestinationLocalization(defaultExceptionDestDef,
                                                       createLocalizationDefinition(defaultExceptionDestDef
                                                                       .getName()), destinationLocalizingMEs, false);

        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.exit(tc, "createSystemDefaultExceptionDestination",
                       defaultExceptionDestDef);

        return defaultExceptionDestDef;
    }
257477
protected SIBusMessage readMessage (SIMessageHandle handle)
                throws ResourceException, SIMessageNotLockedException
    {
        final String methodName = "readMessage";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.entry(this, TRACE, methodName, handle);
        }

        SIBusMessage message = null;

        // If we are enlisted in the xa transaction then delete the message
        // under that transaction.
        if ((_xaResource != null) && (_xaResource.isEnlisted ()))
        {
            if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled ())
            {
                SibTr.debug(this, TRACE, "Deleting the message under the xa transaction (Handle=" + handle + ") (xaResource=" + _xaResource + ")");
            }

            message = readAndDeleteMessage(handle, _xaResource);
        }
        else
        {
            // If we have not been enlisted then we can assume that we have
            // inherited the transaction from the local thread which was imported
            // from the message itself. As such we can not delete the message
            // under this transaction because if the message rolls back the message
            // will be redelivered and we can not reuse the same transaction since
            // it is no longer a valid transaction. Once the transaction has been
            // imported then the message has done its "work" and we can auto commit
            // the deletion.
            if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled ())
            {
                SibTr.debug(this, TRACE, "xaResource is either null or is not enlisted so deleting the message non transactional (auto commit) (Handle=" + handle + ")");
            }

            message = readAndDeleteMessage(handle, null);
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.exit(this, TRACE, methodName, message);
        }

        return message;
    }