Handle a filtered message by inserting it in to the
appropriate target stream as Silence.
Since we only need to do this on exisiting TargetStreams, if the
streamSet or stream are null we give up

@param msgItem
@throws SIResourceException
482009
public void handleSilence(MessageItem msgItem) throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "handleSilence", new Object[] { msgItem });

    JsMessage jsMsg = msgItem.getMessage();

    int priority = jsMsg.getPriority().intValue();
    Reliability reliability = jsMsg.getReliability();

    StreamSet streamSet = getStreamSetForMessage(jsMsg);

    if(streamSet != null)
    {
      TargetStream targetStream = null;
      synchronized(streamSet)
      {
        targetStream = (TargetStream) streamSet.getStream(priority, reliability);
      }
      if(targetStream != null)
      {
        // Update the stateStream with Silence
        targetStream.writeSilence(msgItem);
      }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "handleSilence");
  }
906247
public void freeListenersWithSource(Object objSource)
    {
        if (m_messageMap != null)
        {
            for (BaseMessageQueue messageQueue : m_messageMap.values())
            {
                if (messageQueue != null)
                    messageQueue.freeListenersWithSource(objSource);
            }
        }
    }
825834
@Override
    public void deliverExpressMessage(MessageItem msgItem,
                                      ExpressTargetStream expressTargetStream) throws SIResourceException, SIIncorrectCallException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "deliverExpressMessage", new Object[] { msgItem });

        //Create transaction
        LocalTransaction siTran = _txManager.createLocalTransaction(false);

        try
        {
            // msg is currently the last message in the list
            // get it's tick value for use in sending Acks and updating stream
            long endTick = msgItem.getMessage().getGuaranteedValueValueTick();

            msgItem.setTransacted(true);

            //get the matching results back from the message
            MessageProcessorSearchResults searchResults = msgItem.getSearchResults();

            // Store it
            boolean stored = deliverToConsumerDispatchers(searchResults, msgItem, siTran, false);

            // Update the completedPrefix on the stream
            // This will put all ticks before this point into Completed state
            expressTargetStream.setCompletedPrefix(endTick);

            if (stored)
                siTran.commit();
            else
                siTran.rollback();

        } catch (SIResourceException e)
        {
            // No FFDC code needed
            handleRollback(siTran);

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

            throw e;
        } catch (RuntimeException e)
        {
            // FFDC
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.PubSubInputHandler.deliverExpressMessage",
                                        "1:2908:1.329.1.1",
                                        this);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            {
                SibTr.exception(tc, e);
                SibTr.exit(tc, "deliverExpressMessage", e);
            }

            throw e;
        } catch (SIIncorrectCallException e)
        {
            // No FFDC code needed
            handleRollback(siTran);

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

            throw e;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "deliverExpressMessage");
    }
954560
public synchronized void writeValue(MessageItem msgItem)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "writeValue", msgItem);
    
    timeLastMsgReceived = System.currentTimeMillis();
      
    if(msgItem.getMessage().getGuaranteedValueValueTick() > lastTick)
    {  
      try
      {
        //Check if the stream is full.
        //For express target streams, we simply look at whether the
        //number of messages on the destination is higher than the destination
        //high limit. 
        //See defect 24425
        if(isStreamFull(msgItem.getMessage()))
        {
          //there is no room for this message so we discard it
          if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
          {
            SibTr.debug(tc, "discarding message as the stream is full.");
          }
        }
        else
        {
          deliverer.deliverExpressMessage(msgItem,this);
          messagesReceived++;  
        }
      }
      catch (SIException e)
      {
        // FFDC
        FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.gd.ExpressTargetStream.writeValue",
          "1:181:1.54",
          this);

        SibTr.exception(tc, e);

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

        throw new SIErrorException(e);
      }
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writeValue");
  }
1014631
public final void mSOURCE() throws RecognitionException {
        try {
            int _type = SOURCE;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:120:7: ( ( 'S' | 's' ) ( 'O' | 'o' ) ( 'U' | 'u' ) ( 'R' | 'r' ) ( 'C' | 'c' ) ( 'E' | 'e' ) )
            // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:120:9: ( 'S' | 's' ) ( 'O' | 'o' ) ( 'U' | 'u' ) ( 'R' | 'r' ) ( 'C' | 'c' ) ( 'E' | 'e' )
            {
            if ( input.LA(1)=='S'||input.LA(1)=='s' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            if ( input.LA(1)=='O'||input.LA(1)=='o' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            if ( input.LA(1)=='U'||input.LA(1)=='u' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            if ( input.LA(1)=='R'||input.LA(1)=='r' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            if ( input.LA(1)=='C'||input.LA(1)=='c' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        	// do for sure before leaving
        }
    }
396737
protected void eventPostRollbackRemove(
                                           SIMPMessage msg,
                                           TransactionCommon transaction) throws SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "eventPostRollbackRemove",
                        new Object[] { msg, transaction });

        // NB: ideally this would go in afterCompletion but we
        // dont have the transaction reference to register for the callback
        synchronized (orderLock)
        {

            // Remove the transaction from the transactionSet if applicable
            // Use the orderLock to synch with attachConsumer
            if (transactionSet != null)
            {
                transactionSet.remove(transaction.getPersistentTranId());
                if (transactionSet.isEmpty())
                {
                    transactionSet = null;
                    // Get the consumer and resume it
                    consumerPoints.get(0).
                                    getConsumerPoint().
                                    resumeConsumer(DispatchableConsumerPoint.SUSPEND_FLAG_INITIAL_INDOUBTS);
                }
            }
        }

        // 174107.1
        // Msgstore state model shows that rollback moves to locked state (IF the message
        // was removed under a lock).
        // We must explicitly unlock the message before finding a new consumer.
        try
        {
            if (!msg.isPersistentlyLocked())
            {
                if (!msg.isHidden())
                {
                    if (msg.isLocked())
                        msg.unlockMsg(msg.getLockID(), null, true);
                    else
                        msg.eventUnlocked();
                }
            }
        } catch (MessageStoreException e)
        {
            // MessageStoreException shouldn't occur so FFDC.
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.ConsumerDispatcher.eventPostRollbackRemove",
                                        "1:2618:1.280.5.25",
                                        this);

            SibTr.exception(tc, e);
            SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                        new Object[] {
                                      "com.ibm.ws.sib.processor.impl.ConsumerDispatcher",
                                      "1:2625:1.280.5.25",
                                      e });

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

            throw new SIResourceException(
                            nls.getFormattedMessage(
                                                    "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                                                    new Object[] {
                                                                  "com.ibm.ws.sib.processor.impl.ConsumerDispatcher",
                                                                  "1:2636:1.280.5.25",
                                                                  e },
                                                    null),
                            e);
        }
        //do not want to call internalPut again yet - internalPut will be called from the
        //eventUnlocked callback

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "eventPostRollbackRemove");
    }
961559
async function handleMessagePing(state, msgObj) {

    /**
     * when there are no listener, we do nothing
     */
    if (!state.messagesCallback) return;

    let messages;
    if (!msgObj) {
        // get all
        messages = await getAllMessages(state.channelName, state.paths);
    } else {
        // get single message
        messages = [
            getSingleMessage(state.channelName, msgObj, state.paths)
        ];
    }

    const useMessages = messages
        .filter(msgObj => _filterMessage(msgObj, state))
        .sort((msgObjA, msgObjB) => msgObjA.time - msgObjB.time); // sort by time


    // if no listener or message, so not do anything
    if (!useMessages.length || !state.messagesCallback) return;

    // read contents
    await Promise.all(
        useMessages
        .map(
            msgObj => readMessage(msgObj).then(content => msgObj.content = content)
        )
    );

    useMessages.forEach(msgObj => {
        state.emittedMessagesIds.add(msgObj.token);

        if (state.messagesCallback) {
            // emit to subscribers
            state.messagesCallback(msgObj.content.data);
        }
    });
}
1295963
public void forceFlush(SIBUuid12 streamID)
    throws SIResourceException, SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "forceFlush", new Object[] { streamID });

    // Synchronize to resolve racing messages.
    synchronized (flushMap)
    {
      FlushQueryRecord entry = flushMap.remove(streamID);

      // Remove the entry (we may not have even had
      // one), then clean up any existing stream state.  Also, make
      // sure we turn off the alarm if there IS an entry.  Note that
      // an alarm will always be present if an entry exists.
      if (entry != null)
         entry.resend.cancel();

      flush(streamID);

    }

    //If all the inbound stream sets are empty, queue the destination that the
    //inbound streams are for to the asynch deletion thread, incase any cleanup
    //of the destination is required.  If not, the asynch deletion thread will do
    //nothing.
 //   if (isEmpty())
 //   {
 //     DestinationManager destinationManager = messageProcessor.getDestinationManager();
 //     BaseDestinationHandler destinationHandler = protocolItemStream.getDestinationHandler();
 //     destinationManager.markDestinationAsCleanUpPending(destinationHandler);
 //   }


    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "forceFlush");
  }
745241
public void sendSilenceMessage(
    long startStamp,
    long endStamp,
    long completedPrefix,
    boolean requestedOnly,      
    int priority,
    Reliability reliability,
    SIBUuid12 stream)
    throws SIResourceException
  {

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "sendSilenceMessage");

    ControlSilence sMsg;
    try
    {
      // Create new Silence message
      sMsg = cmf.createNewControlSilence();
    }
    catch (Exception e)
    {
      // FFDC
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.PtoPOutputHandler.sendSilenceMessage",
        "1:849:1.241",
        this);

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

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

      throw new SIResourceException(
        nls.getFormattedMessage(
          "INTERNAL_MESSAGING_ERROR_CWSIP0002",
          new Object[] {
            "com.ibm.ws.sib.processor.impl.PtoPOutputHandler",
            "1:867:1.241",
            e },
          null),
        e);
    }

    // As we are using the Guaranteed Header - set all the attributes as
    // well as the ones we want.
    SIMPUtils.setGuaranteedDeliveryProperties(sMsg,
        messageProcessor.getMessagingEngineUuid(), 
        targetMEUuid,
        stream,
        null,
        destinationHandler.getUuid(),
        ProtocolType.UNICASTINPUT,
        GDConfig.PROTOCOL_VERSION);
  
    sMsg.setStartTick(startStamp);
    sMsg.setEndTick(endStamp);
    sMsg.setPriority(priority);
    sMsg.setReliability(reliability);
    sMsg.setCompletedPrefix(completedPrefix);

    // If the destination in a Link add Link specific properties to message
    if( isLink )
    {
      sMsg = (ControlSilence)addLinkProps(sMsg);
    }
    
    // If the destination is system or temporary then  the 
    // routingDestination into th message
    if( this.isSystemOrTemp )
    {
      sMsg.setRoutingDestination(routingDestination); 
    }
 
    // Send message to destination
    // Using MPIO
    // If requestedOnly then this is a response to a Nack so resend at priority+1 
    if( requestedOnly )
      mpio.sendToMe(routingMEUuid, priority+1, sMsg);
    else
      mpio.sendToMe(routingMEUuid, priority, sMsg);
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "sendSilenceMessage");

  }
1084608
private void reconstituteTargetStreams(ProducerInputHandler inputHandler)
    throws MessageStoreException,
    SIException,
    SIResourceException   
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "reconstituteTargetStreams");

    /*
     * Iterate through all contained Protocol Items, rebuilding
     * associated target streams for each.
     */ 
    NonLockingCursor cursor = null;
    
    try
    {
      cursor = newNonLockingItemCursor(new ClassEqualsFilter(StreamSet.class));
           
	    AbstractItem item = null;
	    while (null != (item = cursor.next()))
	    {
	      StreamSet streamSet = (StreamSet)item;
	      inputHandler.reconstituteTargetStreams(streamSet);
	    }
    }
    finally
    {
      if (cursor != null)
        cursor.finished();
    }

    if (tc.isEntryEnabled())  
      SibTr.exit(tc, "reconstituteTargetStreams");      
  }
357549
public void handleControlMessage(SIBUuid8 sourceMEUuid, ControlMessage cMsg) 
  
  throws SIConnectionLostException, SIRollbackException, SIIncorrectCallException, SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "handleControlMessage", new Object[]{sourceMEUuid,cMsg});
    
    // Work out type of ControlMessage and process it
    ControlMessageType type = cMsg.getControlMessageType();

    // Forward flush queries to our parent.  The cellule
    // we pass here doesn't actually matter since our PubSubInputHandler
    // will ignore it and just use the one in the message.
    if (type == ControlMessageType.REQUESTFLUSH) 
    {
      _parentInputHandler.handleControlMessage(_targetMEUuid, cMsg);      
    }
  
    // Forward flush queries to our parent.  The cellule
    // we pass here doesn't actually matter since our PubSubInputHandler
    // will ignore it and just use the one in the message.
    else if ( type == ControlMessageType.AREYOUFLUSHED)
    {
      _internalOutputStreamManager.processFlushQuery((ControlAreYouFlushed)cMsg);      
    }
    
    // Now we can process the rest of the control messages...
    
    else if (type == ControlMessageType.ACK)
    {
      _internalOutputStreamManager.processAck((ControlAck)cMsg);
    }
    else if (type == ControlMessageType.NACK)
    {
      _internalOutputStreamManager.processNack((ControlNack)cMsg);
    }
    else
    {
      // Not a recognised type
      // throw exception
    }

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

  }
882618
@Override
    public void deliverExpressMessage(MessageItem msgItem,
                                      ExpressTargetStream expressTargetStream)

                    throws SIIncorrectCallException, SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "deliverExpressMessage", new Object[] { msgItem });

        //Create transaction
        LocalTransaction siTran = _txManager.createLocalTransaction(false);

        try
        {
            long endTick = msgItem.getMessage().getGuaranteedValueValueTick();

            JsDestinationAddress routingDestinationAddr =
                            msgItem.getMessage().getRoutingDestination();
            if (routingDestinationAddr != null)
            {
                DestinationHandler routingDestination = null;
                try
                {
                    routingDestination =
                                    _destinationManager.getDestination(routingDestinationAddr, false, true);

                    if (_isLink)
                    {
                        LinkHandler link = (LinkHandler) _destination;

                        // If this is coming in off a link then use the link's configuration
                        // to determine if any local message points should be preferred
                        msgItem.setPreferLocal(link.preferLocalTargetQueuePoint());

                        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());
                        }
                    }
                    // 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);

                    // Call the handler to deal with the message - passing null as the producer
                    // session id.
                    ProducerInputHandler inputHandler =
                                    (ProducerInputHandler) routingDestination.getInputHandler();

                    inputHandler.handleMessage(msgItem,
                                               siTran,
                                               _messageProcessor.getMessagingEngineUuid());

                } catch (SIException e)
                {
                    // No FFDC code needed

                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    {
                        SibTr.exception(tc, e);
                        SibTr.debug(tc, "Discarding the express message as it could not be from the targetStreamManager");
                    }
                }
            }
            else
            {
                ConsumerDispatcher consumerDispatcher;

                consumerDispatcher = (ConsumerDispatcher) _destination.getLocalPtoPConsumerManager();
                consumerDispatcher.put(msgItem, siTran, null, false);
            }

            // Update the completedPrefix on the stream
            // This will put all ticks before this point into Completed state
            expressTargetStream.setCompletedPrefix(endTick);

            siTran.commit();
        } catch (SIIncorrectCallException e)
        {
            // No FFDC code needed
            handleRollback(siTran);

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

            throw e;
        } catch (SIResourceException e)
        {
            // No FFDC code needed
            handleRollback(siTran);

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

            throw e;
        } catch (RuntimeException e)
        {
            // FFDC
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.PtoPInputHandler.deliverExpressMessage",
                                        "1:2840:1.323",
                                        this);

            handleRollback(siTran);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            {
                SibTr.exception(tc, e);
                SibTr.exit(tc, "deliverExpressMessage", e);
            }

            throw e;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "deliverExpressMessage");
    }
645210
public void processFlushQuery(ControlAreYouFlushed flushQuery) throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "processFlushQuery", new Object[] { flushQuery });

    SIBUuid12 streamID = flushQuery.getGuaranteedStreamUUID();

    try
    {
      //synchronize to give a consistent view of the flushed state
      synchronized(this)
      {
        SIBUuid8 requestor = flushQuery.getGuaranteedSourceMessagingEngineUUID();
        if(isFlushed(streamID))
        {
          // It's flushed.  Send a message saying as much.
          downControl.sendFlushedMessage(requestor, streamID);
        }
        else
        {
          // Not flushed.  Send a message saying as much.
          downControl.sendNotFlushedMessage(requestor, streamID, flushQuery.getRequestID());
        }
      }
    }
    catch (SIResourceException e)
    {
      // FFDC
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.gd.SourceStreamManager.processFlushQuery",
        "1:1333:1.102",
        this);

      SibTr.exception(tc, e);

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

      throw e;
    }

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

  }
108756
public boolean writeSilenceForced(SIMPMessage m) throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "writeSilenceForced", new Object[] { m });

    boolean msgRemoved = true;
    
    JsMessage jsMsg = m.getMessage();

    long start = jsMsg.getGuaranteedValueStartTick();
    long end  = jsMsg.getGuaranteedValueEndTick();

    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
    {
      SibTr.debug(tc, "writeSilenceForced from: " + start + " to " + end + " on Stream " +  stream);
    }
   
    TickRange tr =
      new TickRange(
        TickRange.Completed,
        start,
        end);

    // used to send message if it moves inside inDoubt window
    List sendList = null;
    
    synchronized (this)
    {
      // If the tick of the new silence has already been set to completed then
      // the message must already have been processed (either sent+acked or already
      // silenced) either way, we should class it as a 'removed' message.
      // This fixes a problem where a message is nacked,sent and acked all in the
      // window between setting it as a value and actually trying to lock it (in PtoPOutputHandler)
      // prior to sending it. In this situation, the message no longer exists in the
      // MsgStore, so PtoPOutputHandler believed it had expired, which then calls this
      // method to try to remove it - decrementing the totalMessage count and messing
      // up future sendWindow calculations (which can leave messages left unsent).
      if(end <= getCompletedPrefix())
      {
        msgRemoved = false;
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
          SibTr.debug(tc, "Message " + end + " already completed", m);
      }
      else
      {
          oststream.writeCompletedRangeForced(tr);
          
          // Check whether removing this message means we have
          // a message to send
          TickRange str = null;
          if ( (str = msgRemoved(jsMsg.getGuaranteedValueValueTick(), oststream, null)) != null)
          {
            sendList = new LinkedList();
            sendList.add(str);
            if(str.valuestamp > lastMsgSent)
              lastMsgSent = str.valuestamp;
          }  
      }
    }

    // Do the send outside of the synchronise
    if (sendList != null)
    {
      sendMsgs( sendList, false );
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "writeSilenceForced", Boolean.valueOf(msgRemoved));
    
    return msgRemoved;

  }
965972
private void addBestEffortMessage(SIMPMessage msgItem) throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "addBestEffortMessage", new Object[] { msgItem });
    
    // Get the JsMessage as we need to update the Guaranteed fields
    JsMessage jsMsg = msgItem.getMessage();
 
    long tick = this.messageProcessor.nextTick();

    //Set a unique id in the message if explicitly told to or
    //if one has not already been set
    if(msgItem.getRequiresNewId()  ||  jsMsg.getSystemMessageId()==null)
    {
      jsMsg.setSystemMessageSourceUuid(this.messageProcessor.getMessagingEngineUuid());
      jsMsg.setSystemMessageValue(tick);
      msgItem.setRequiresNewId(false);
    }

    jsMsg.setGuaranteedValueEndTick(tick);
    jsMsg.setGuaranteedValueValueTick(tick);
    jsMsg.setGuaranteedValueRequestedOnly(false);

    // Keep MFP happy
    jsMsg.setGuaranteedValueStartTick(-1);
    jsMsg.setGuaranteedValueCompletedPrefix(-1);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "addBestEffortMessage");
  }
291737
public void writeSilenceForced(long tick) throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "writeSilenceForced",  Long.valueOf(tick) );
    
    // Details of the new silence
    long startTick = -1;
    long endTick = -1;
    long completedPrefix = -1;
    
    // used to send message if it moves inside inDoubt window
    List sendList = null;
    
    synchronized (this)
    {
      oststream.setCursor(tick);

      // Get the TickRange containing this tick 
      TickRange tr = oststream.getNext();
        
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
      {
        SibTr.debug(tc, "writeSilenceForced from: " + tr.startstamp + " to " + tr.endstamp + " on Stream " +  stream);
      }
  
      TickRange silenceRange = oststream.writeCompletedRangeForced(tr);
      
      // While we have the stream locked cache the details of the new completed
      // range
      if(silenceRange != null)
      {
        startTick = silenceRange.startstamp;
        endTick = silenceRange.endstamp;
        completedPrefix = getCompletedPrefix();
      }
      
      // Check whether removing this message means we have
      // a message to send
      TickRange str = null;
      if ( (str = msgRemoved(tick, oststream, null)) != null)
      {
        sendList = new LinkedList();
        sendList.add(str);
        if(str.valuestamp > lastMsgSent)
          lastMsgSent = str.valuestamp;
      }
    }
    
    // Do the send outside of the synchronise
    
    // If we created a new completed (silenced) range then we actually send this to the
    // target ME. If we don't do this it's possible for the target to never realise that
    // this message has been explicitly deleted (via the MBeans), and therefore, if there's
    // a problem with the message it will never know to give up trying to process it, which
    // could leave the stream blocked until an ME re-start.
    if(startTick != -1)
    {
      downControl.sendSilenceMessage(startTick,
          endTick,
          completedPrefix,
          false,
          priority,
          reliability,
          stream);
    }
   
    if (sendList != null)
    {
      sendMsgs( sendList, false );
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "writeSilenceForced");

  }
11776
public void sendNotFlushedMessage(SIBUuid8 ignore, SIBUuid12 streamID, long requestID) 
  throws SIResourceException 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "sendNotFlushedMessage", 
        new Object[]{ignore, streamID, new Long(requestID)});
        
    ControlNotFlushed notFlushed = createControlNotFlushed(_targetMEUuid, streamID, requestID);
    notFlushed = _internalOutputStreamManager.stampNotFlushed(notFlushed, streamID);
    
    // If the destination in a Link add Link specific properties to message
    if( _isLink )
    {
      notFlushed = (ControlNotFlushed)addLinkProps(notFlushed);
      notFlushed.setRoutingDestination(_routingDestination);
    }
    _mpio.sendToMe(_targetMEUuid, SIMPConstants.MSG_HIGH_PRIORITY, notFlushed);    
        
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "sendNotFlushedMessage");  
  }