Overwrite acceptInboundMessage to properly delegate ChunkFetchRequest messages
to ChunkFetchRequestHandler.
329505
@Override
  public boolean acceptInboundMessage(Object msg) throws Exception {
    if (msg instanceof ChunkFetchRequest) {
      return false;
    } else {
      return super.acceptInboundMessage(msg);
    }
  }
1211492
@Override
    public void setGatherMessages(String gatherMessages) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setGatherMessages", gatherMessages);

        // Make sure null and empty are treated equally.
        if ((gatherMessages == null) || ("".equals(gatherMessages.trim())))
            gatherMessages = null;

        if ((gatherMessages == null) ||
            (ApiJmsConstants.GATHER_MESSAGES_OFF.equals(gatherMessages) ||
            (ApiJmsConstants.GATHER_MESSAGES_ON.equals(gatherMessages)))) {

            updateProperty(GATHER_MESSAGES, gatherMessages);
        }
        else {
            // bad value, throw exception
            String key = "INVALID_VALUE_CWSIA0281";
            Object[] inserts = new Object[] { GATHER_MESSAGES, gatherMessages };
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class, key, inserts, tc);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setGatherMessages");
    }
2520
protected void redeliverMessage( AbstractMessage msg , MessageStore store , int handle )
    {
    	try
    	{
	    	synchronized (storeLock)
	        {
		    	// Unlock message in store
		   		store.unlock(handle);
		   		if (traceEnabled)
		        	log.trace("(Deferred) UNLOCKED "+msg.getJMSMessageID());
	        }
	    	
	    	// Dispatch notification
	    	sendAvailabilityNotification(msg);
    	}
    	catch (JMSException e)
    	{
    		ErrorTools.log(e, log);
    	}
    }
1036044
void handleRequest(ByteBuf buffer) {
    long requestId = buffer.readLong();

    try {
      Object request = readRequest(buffer);
      HandlerHolder handler = handlers.get(request.getClass());
      if (handler != null) {
        handler.context.executor().execute(() -> handleRequest(requestId, request, handler));
      } else {
        handleRequestFailure(requestId, new SerializationException("unknown message type: " + request.getClass()), this.context);
      }
    } catch (SerializationException e) {
      handleRequestFailure(requestId, e, this.context);
    } finally {
      buffer.release();
    }
  }
470242
@Override
    public void setRequest(HttpRequestMessage msg) throws IllegalRequestObjectException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "setRequest: " + msg);
        }

        // null message isn't allowed
        if (null == msg) {
            throw new IllegalRequestObjectException("Illegal null message");
        }

        HttpRequestMessageImpl temp = null;
        try {
            temp = (HttpRequestMessageImpl) msg;
        } catch (ClassCastException cce) {
            // no FFDC required
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Non msg impl passed to setRequest");
            }
            throw new IllegalRequestObjectException("Invalid message provided");
        }
        // possibly clean up any existing request object
        if (null != getMyRequest() && isRequestOwner()) {
            if (!getMyRequest().equals(temp)) {
                getMyRequest().destroy();
            } else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(tc, "Caller overlaying same message");
                }
            }
        }
        // set the new object in place
        setMyRequest(temp);
        // 335554 : the message init() will overwrite the version based on config
        // and needs to be reset back to whatever we started with here.
        VersionValues version = temp.getVersionValue();
        getMyRequest().init(this);
        getMyRequest().setVersion(version);
        updatePersistence(getMyRequest());
        getResponseImpl().setHeaderChangeLimit(getMyRequest().getHeaderChangeLimit());

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "setRequest");
        }
    }
96815
@Deprecated
    public static void setHeader(HttpMessage message, String name, Iterable<?> values) {
        message.headers().set(name, values);
    }
462187
def _handle_request(self, msg_id, method, params):
        """"""
        try:
            handler = self._dispatcher[method]
        except KeyError:
            raise JsonRpcMethodNotFound.of(method)

        handler_result = handler(params)

        if callable(handler_result):
            log.debug("Executing async request handler %s", handler_result)
            request_future = self._executor_service.submit(handler_result)
            self._client_request_futures[msg_id] = request_future
            request_future.add_done_callback(self._request_callback(msg_id))
        else:
            log.debug("Got result from synchronous request handler: %s", handler_result)
            self._consumer({
                'jsonrpc': JSONRPC_VERSION,
                'id': msg_id,
                'result': handler_result
            })
492310
async def _receive_data_chunk(self, chunk):
        
        self._sack_needed = True

        # mark as received
        if self._mark_received(chunk.tsn):
            return

        # find stream
        inbound_stream = self._get_inbound_stream(chunk.stream_id)

        # defragment data
        inbound_stream.add_chunk(chunk)
        self._advertised_rwnd -= len(chunk.user_data)
        for message in inbound_stream.pop_messages():
            self._advertised_rwnd += len(message[2])
            await self._receive(*message)
1205189
private Request bindThreadToRequest(Thread thread, EntryPoint entryPoint) {
		StandardRequest boundRequest; /*= rebindingRequest;*/
//		thread.setContextClassLoader(contextClassLoader);

		int threadId = thread.hashCode();
		synchronized (requestsByThreadId) {
			StandardRequest previouslyBoundRequest = (StandardRequest) requestsByThreadId.get(threadId);

			if (previouslyBoundRequest == null) {
				boundRequest = new StandardRequest(entryPoint, this);
				requestsByThreadId.put(threadId, boundRequest);
			} else {
				// request is already bound, it will not be overwritten
				previouslyBoundRequest.increaseTimesEntered();
				boundRequest = previouslyBoundRequest;
			}
		}
		return boundRequest;
	}
245198
public void handleNotFlushedMessage(ControlNotFlushed cMsg)

  throws SIIncorrectCallException, SIErrorException, SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "handleNotFlushedMessage", new Object[] { cMsg });

    SIBUuid12 streamID = cMsg.getGuaranteedStreamUUID();
    //Synchronize to resolve racing messages.
    synchronized (flushMap)
    {
      FlushQueryRecord entry = flushMap.get(streamID);
      // make sure the request ID matches.
      long reqId = cMsg.getRequestID();
      //if there is no entry or the entry's request ID does not match then
      //it must have been a stale request and we ignore it.
      if ((entry != null) && (entry.requestID == reqId))
      {
        // ASSERT.isTrue(entry.cache != null)

        // The assertion basically means that we should only receive
        // NOTFLUSHED if the original query was AREYOUFLUSHED.  The
        // only legal reply to REQUESTFLUSH is, eventually, FLUSHED.

        // Our original query was for "are you flushed" and we now
        // have the reply, so:
        // 1) remove the entry from the flush map and disable the alarm
        // 2) handle the new prefixes and replay any cached data messages.
        flushMap.remove(streamID);
        entry.resend.cancel();

        StreamSet streamSet = getStreamSetForMessage(cMsg);

        if(streamSet == null)
        {
          //check that we don't already have a streamSet for this source, because there
          // should only be the one at any one time (except for links, see below...)
          SIBUuid8 sourceMEUuid = cMsg.getGuaranteedSourceMessagingEngineUUID();
          if(sourceMap.containsValue(sourceMEUuid))
          {
            //if we do, try to remove it
            Iterator<SIBUuid12> itr = sourceMap.keySet().iterator();
            while(itr.hasNext())
            {
              SIBUuid12 sid = itr.next();
              SIBUuid8 uuid = sourceMap.get(sid);
              if(sourceMEUuid.equals(uuid))
              {
                // 538529
                // If this is a link it is possible to have multiple streams of messages
                // coming in from the source ME concurrently. We have one for all point-to-point
                // messages and one per topicspace that is sending messages to us.
                // Ideally we need to check with the source before we flush any of our existing
                // streams, as they may still be valid. We would do this by asking the sender if
                // they are flushed (commented out code below). Unfortunately we can't do that because
                // the sender (the other end of the link) may not be the source of the messages
                // so it's not guaranteed to actually know about this stream even if it still
                // exists (for example the ME's just been restarted and lost the non-persistent
                // state for this stream). So, instead we simply keep all streams.
                // TODO This isn't ideal so maybe we can fix it in the future 
                if(destination.isLink())
                {
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc, "WARNING: Existing Link stream, " + sid + ", not flushed");
                  
//                  StreamSet existingStreamSet = (StreamSet)streamSets.get(sid);
//
//                  // Create and store the new request record
//                  long reqID = messageProcessor.nextTick();
//                  FlushQueryRecord newEntry = new FlushQueryRecord(sourceMEUuid,
//                                               existingStreamSet.getDestUuid(),
//                                               existingStreamSet.getBusUuid(),
//                                               null,
//                                               reqID);
//                  flushMap.put(sid, newEntry);
//
//                  // Create and send the query
//                  upControl.sendAreYouFlushedMessage(sourceMEUuid,
//                                                     existingStreamSet.getDestUuid(),
//                                                     existingStreamSet.getBusUuid(),
//                                                     reqID,
//                                                     sid);
//
//                  // Start the alarm.  The context for the alarm is the stream id, which
//                  // we can use to look up the FlushQueryRecord if the alarm expires.
//                  newEntry.resend = am.create(GDConfig.FLUSH_QUERY_INTERVAL, this, sid);
                }
                // If we're not a link we only ever expect a single streamSet to be in use
                // by the source at any one time, so flush any that we already have.
                else
                {
                  flush(sid);
                  //there should only ever be at most one other streamSet found
                  //so stop looking if we found one.
                  break;
                }
              }
            }
          }
          
          // If this is a link, get the actual target destination 
          String linkTarget = SIMPConstants.PTOP_TARGET_STREAM;
          JsDestinationAddress routingDest = cMsg.getRoutingDestination();
          if (destination.isLink() &&  routingDest!= null)
          {
            // get the destination and check if it is a topicspace
            DestinationHandler dest = 
              destination.getDestinationManager().
                getDestinationInternal(routingDest.getDestinationName(),
                                       routingDest.getBusName(), true);
            if (dest!=null && dest.isPubSub())
              linkTarget = routingDest.getDestinationName();
          }           
          
          //create a new streamSet
          SIBUuid8 busId = cMsg.getGuaranteedCrossBusSourceBusUUID();
          if( busId == null)
          {
            busId = messageProcessor.getMessagingEngineBusUuid();
          }
          streamSet = addNewStreamSet(streamID,
                                      sourceMEUuid,
                                      cMsg.getGuaranteedTargetDestinationDefinitionUUID(),
                                      busId,
                                      linkTarget);
          //set all the completed prefixes
          long[] completedPrefixes = cMsg.getCompletedPrefixTicks();
          int[] priority  = cMsg.getCompletedPrefixPriority();
          int[] reliability = cMsg.getCompletedPrefixQOS();
          for(int i=0;i<completedPrefixes.length;i++)
          {
            streamSet.setPersistentData(priority[i],
                                                Reliability.getReliability(reliability[i]),
                                                completedPrefixes[i]);
          }
        }
        // Now replay any cached messages
        for(int i=0; i<entry.cacheIndex; i++)
        {
          handleMessage(entry.cache[i]);
        }
      }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "handleNotFlushedMessage");
  }
1152548
protected void internalMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
        /**
         * All incoming internal messages are either op commands, or aggregation messages that are tied to commands
         */
        byte[] data = new byte[length];
        buffer.getBytes(offset, data);

        VoidMessage message = VoidMessage.fromBytes(data);

        messages.add(message);

        //    log.info("internalMessageHandler message request incoming: {}", message.getClass().getSimpleName());
    }
339222
public void consumeMessages(LockedMessageEnumeration messages) throws Exception
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "consumeMessages", new Object[] { messages });

    SIBusMessage jsMessage = null;
    
    while (messages.hasNext())
    {    
      try
      {
        jsMessage = messages.nextLocked();
      }
      catch (SIException e)
      {
        FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.proxyhandler.NeighbourProxyListener.consumeMessages",
          "1:157:1.73",
          this);
          
        SibTr.exception(tc, e);
      }
  
      if (jsMessage!=null && 
          ((JsMessage) jsMessage).getJsMessageType() != MessageType.SUBSCRIPTION)
      {
        if (tc.isDebugEnabled())
          SibTr.debug(
            tc,
            "Message On incorrect Destination, expecting message "
              + "of Type "
              + MessageType.SUBSCRIPTION
              + " received "
              + ((JsMessage) jsMessage).getJsMessageType());
              
        if (tc.isEntryEnabled()) SibTr.exit(tc, "consumeMessages");
        return;
      }
  
      // Only continue if the message returned is not null
      if (jsMessage!=null)
      {    
        SubscriptionMessage subMessage = null;     
        
        try
        {
          subMessage = ((JsMessage) jsMessage).makeInboundSubscriptionMessage();
        }
        catch (IncorrectMessageTypeException e)
        {
          FFDCFilter.processException(
            e,
            "com.ibm.ws.sib.processor.proxyhandler.NeighbourProxyListener.consumeMessages",
            "1:193:1.73",
            this);
            
          SibTr.exception(tc, e);
        }
        
        // Invoke the limited ME comms trace again now that we have fluffed up the message
        if (TraceComponent.isAnyTracingEnabled()) {
          MECommsTrc.traceMessage(tc, 
              iProxyHandler.getMessageProcessor(), 
              subMessage.getGuaranteedSourceMessagingEngineUUID(),
              MECommsTrc.OP_SUBMSG_CONSUME, 
              null, 
              subMessage);
        }
        
        LocalTransaction transaction = null;
        
        // Switch on the Type of the Message to understand what we need to 
        // process
        try
        {
          
          // Get a transaction to operate under
          transaction = iProxyHandler.getTransactionManager().createLocalTransaction(true);
    
          switch (subMessage.getSubscriptionMessageType().toInt())
          {
            case SubscriptionMessageType.CREATE_INT :
    
              // Create a new Proxy subscription
              handleCreateProxySubscription(subMessage, (Transaction) transaction);
    
              break;
    
            case SubscriptionMessageType.DELETE_INT :
    
              // Delete a proxy subscription
              handleDeleteProxySubscription(subMessage, (Transaction) transaction);
    
              break;
    
            case SubscriptionMessageType.RESET_INT :
    
              // Reset the subscription state.
              handleResetState(subMessage, (Transaction) transaction, false);
    
              break;
    
            case SubscriptionMessageType.REQUEST_INT :
    
              // Reset the subscription state.
              handleResetState(subMessage, (Transaction) transaction, true);
    
              break;
  
            case SubscriptionMessageType.REPLY_INT :
    
              // Reset the subscription state.
              handleResetState(subMessage, (Transaction) transaction, false);
    
              break;
            default :
              // Log Message
              break;
          }
    
          // Delete the current message from the destination as we 
          // have now read it.
          messages.deleteCurrent(transaction);
        
          // Commit the transaction.
          transaction.commit();
        }      
        catch (SIException e)
        {        
          // If there are any exceptions, then this is bad, log a FFDC
          FFDCFilter.processException(
            e,
            "com.ibm.ws.sib.processor.proxyhandler.NeighbourProxyListener.consumeMessages",
            "1:273:1.73",
            this);
            
          SibTr.exception(tc, e);
          
          handleRollback(subMessage, transaction);                
        }
        catch (RuntimeException e)
        {        
          // If there are any exceptions, then this is bad, log a FFDC
          FFDCFilter.processException(
            e,
            "com.ibm.ws.sib.processor.proxyhandler.NeighbourProxyListener.consumeMessages",
            "1:286:1.73",
            this);
            
          SibTr.exception(tc, e);
          
          handleRollback(subMessage, transaction);        
          
          if (tc.isEntryEnabled()) SibTr.exit(tc, "consumeMessages", e);
          
          throw e;
        }
  
      }
    }

    if (tc.isEntryEnabled())
      SibTr.exit(tc, "consumeMessages");
  }
696952
@Override
	public void onFetchFinish(MessageManager manager, List<ApptentiveMessage> messages) {
		if (isPolling()) {
			long pollingInterval = getPollingInterval();
			ApptentiveLog.v(MESSAGES, "Scheduled polling messages in %d sec", pollingInterval / 1000);
			dispatchOnConversationQueueOnce(messagePollingTask, pollingInterval);
		}
	}
823524
function handleIncomingMessage(data) {
		var message;
		reader.parse(data, initPending);
		initPending = false;
		while (!reader.isEmpty()) {
			message = reader.pop();
			// console.log("IN MESSAGE: " + inspect(message));
			// Check if there are listeners attached to the event
			// otherwise falls back to the default handler
			if (that.listeners(message.verb).length) {
				handlers[message.verb](message);
			} else {
				defHandlers[message.verb].call(that, message);
			}
		}
	}
1188634
public static void enrich(Throwable t, String updateMessage) {
    String newMessage = createMessage(t.getMessage(), updateMessage, t.getClass().getSimpleName());
    replace(t, newMessage);
  }
1017267
protected <T extends SAMLObject> void prepareSamlOutboundDestinationHandler(final MessageContext<T> outboundContext) throws Exception {
        val handlerDest = new SAMLOutboundDestinationHandler();
        handlerDest.initialize();
        handlerDest.invoke(outboundContext);
    }
465330
@Override
    public void sendNotFlushedMessage(SIBUuid8 target, SIBUuid12 streamID, long requestID)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "sendNotFlushedMessage",
                        new Object[] { target, streamID, new Long(requestID) });

        InvalidOperationException e =
                        new InvalidOperationException(nls.getFormattedMessage(
                                                                              "INTERNAL_MESSAGING_ERROR_CWSIP0001",
                                                                              new Object[] {
                                                                                            "com.ibm.ws.sib.processor.impl.PubSubInputHandler",
                                                                                            "1:3366:1.329.1.1" },
                                                                              null));

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

        // FFDC
        FFDCFilter.processException(
                                    e,
                                    "com.ibm.ws.sib.processor.impl.PubSubInputHandler.sendNotFlushedMessage",
                                    "1:3378:1.329.1.1",
                                    this);

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