Populates the Thread Context Stack with the supplied stack. The information will be popped off when
the instance is closed.

@param messages The list of messages to be added
@return a new instance that will back out the changes when closed.
@since 2.8
509577
public static CloseableThreadContext.Instance pushAll(final List<String> messages) {
        return new CloseableThreadContext.Instance().pushAll(messages);
    }
138933
public static JavacMessages instance(Context context) {
        JavacMessages instance = context.get(messagesKey);
        if (instance == null)
            instance = new JavacMessages(context);
        return instance;
    }
1134758
public static <MSG extends Message> void writeStream(Iterable<MSG> messages, OutputStream output) {
    try {
      for (Message message : messages) {
        message.writeDelimitedTo(output);
      }
    } catch (Exception e) {
      throw ContextException.of("Unable to write messages", e);
    }
  }
1230449
@Override
    public Message newMessage(final String message, final Object... params) {
        return new ParameterizedMessage(message, params);
    }
1297394
protected Message createMessage(ConnectionContext context, BasicMessage basicMessage) throws JMSException {
        return createMessage(context, basicMessage, null);
    }
7714
def add_message message
    el = @messages[message.id]
    return if el.message # we've seen it before

    #puts "adding: #{message.id}, refs #{message.refs.inspect}"

    el.message = message
    oldroot = el.root

    ## link via references:
    (message.refs + [el.id]).inject(nil) do |prev, ref_id|
      ref = @messages[ref_id]
      link prev, ref if prev
      ref
    end

    ## link via in-reply-to:
    message.replytos.each do |ref_id|
      ref = @messages[ref_id]
      link ref, el, true
      break # only do the first one
    end

    root = el.root
    key =
      if thread_by_subj?
        Message.normalize_subj root.subj
      else
        root.id
      end

    ## check to see if the subject is still the same (in the case
    ## that we first added a child message with a different
    ## subject)
    if root.thread
      if @threads.member?(key) && @threads[key] != root.thread
        @threads.delete key
      end
    else
      thread = @threads[key]
      thread << root
      root.thread = thread
    end

    ## last bit
    @num_messages += 1
  end
1022738
public WsByteBuffer[] marshallMessage() throws MessageSentException {
        final boolean bTrace = TraceComponent.isAnyTracingEnabled();
        if (bTrace && tc.isEntryEnabled()) {
            Tr.entry(tc, "marshallMessage");
        }

        preMarshallMessage();
        WsByteBuffer[] marshalledObj = hasFirstLineChanged() ? marshallLine() : null;
        headerComplianceCheck();
        marshalledObj = marshallHeaders(marshalledObj);
        postMarshallMessage();

        if (bTrace && tc.isEntryEnabled()) {
            Tr.exit(tc, "marshallMessage");
        }
        return marshalledObj;
    }
1234338
public void sendMessage(Message message)
    {
        if (message == null)
            return;     // Don't allow a null message to be sent.
        m_stack.add(message);
        if (m_bWaiting)
        {
            synchronized (m_thread)
            {
                if (m_bWaiting) // Inside the sync block
                    m_thread.notify();
            }
        }
    }
902692
protected void notifyEntities(List<HookNotification.HookNotificationMessage> messages) {
        final int maxRetries = atlasProperties.getInt(getNumberOfRetriesPropertyKey(), 3);
        notifyEntities(messages, maxRetries);
    }
687871
public void sendMessage(Message message)
    {
        ((DualMessageQueue)this.getMessageQueue()).getMessageStack().sendMessage(message);
        
        ((BaseMessage)message).setProcessedByClient(true);     // Make sure any server doesn't send this back up.

        super.sendMessage(message);
    }
308611
void addtoAsysncSendQueue(JmsMsgProducerImpl msgProducer, CompletionListener cListner, Message msg, int sendMethodType, Object[] params) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "addtoAsysncSendQueue", new Object[] { msgProducer, cListner, cListner, sendMethodType, params });

        _asyncSendQueue.offer(new AysncSendDetails(msgProducer, cListner, msg, sendMethodType, params));

        if (null == _asyncSendRunThread) {
            //initialize asyncSendRunThread
            _asyncSendRunThread = new Thread(new AsyncSendTask());
            /**
             * setting _asyncSendRunThread as daemon thread. So when all non-daemon threads are complete, this thread would get terminated.
             * So in case if thin client main (alonw with non-daemon threads)are exited, the prgoramm will be exited even though this thread
             * is doing any back ground work. The application has to esnure to wait till all async send work is done before exiting the main.
             */
            _asyncSendRunThread.setDaemon(true);

        }

        //when AsyncSend is in progess, the message object should not get accessed by anyone other than SIB
        // inusebyAsyncSend and AsyncThreadId are used to restrict access for Message object.
        if ((msg != null) && msg instanceof JmsMessageImpl) {
            ((JmsMessageImpl) msg).setAsyncSendInProgress(true);
        }

        if (!_asyncSendRunThread.isAlive()) {
            //The asyncRunThread is not running... then kick off 
            try {
                _asyncSendRunThread.start();
            } catch (Exception e) {
                //absorb the exception and add to trace. 
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc, "addtoAsysncSendQueue: starting asyncRunThread failed", e);
            }
        }

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

    }
1164796
protected function addContextToMessages()
    {
        $context = $this->getContextMessage();

        if ($context === []) {
            return;
        }

        foreach ($this->messages as &$message) {
            $message[0] = ArrayHelper::merge($context, $this->parseText($message[0]));
        }
    }
848852
def add_messages(self, messages):
        
        # remove old messages
        if len(messages) > self.limit:
            messages = messages[:self.limit]
        _logger(self.__class__).log(5, 'adding %s messages' % len(messages))
        self._finished = False
        self._new_messages = messages
        self._to_check = list(self._messages)
        self._pending_msg = messages
        # start removing messages, new message won't be added until we
        # checked all message that need to be removed
        QtCore.QTimer.singleShot(1, self._remove_batch)
1181252
public final PersistException toPersistException(final String message) {
        Throwable cause;
        if (this instanceof PersistException) {
            cause = this;
        } else {
            cause = getCause();
        }

        if (cause == null) {
            cause = this;
        } else if (cause instanceof PersistException && message == null) {
            return (PersistException) cause;
        }

        String causeMessage = cause.getMessage();
        if (causeMessage == null) {
            causeMessage = message;
        } else if (message != null) {
            causeMessage = message + " : " + causeMessage;
        }

        return makePersistException(causeMessage, cause);
    }
1364073
public void setMessages(java.util.Collection<String> messages) {
        if (messages == null) {
            this.messages = null;
            return;
        }

        this.messages = new com.amazonaws.internal.SdkInternalList<String>(messages);
    }
1026670
@Override
    public VoidMessage takeMessage() {
        if (threadingModel != ThreadingModel.SAME_THREAD) {
            try {
                return messages.take();
            } catch (InterruptedException e) {
                // probably we don't want to do anything here
                return null;
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        } else {
            /**
             * PLEASE NOTE: This branch is suitable for debugging only, should never be used in wild life
             */
            // we do inplace poll
            if (subscriptionForShards != null)
                subscriptionForShards.poll(messageHandlerForShards, 512);

            subscriptionForClients.poll(messageHandlerForClients, 512);

            return messages.poll();
        }
    }
1232569
public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
		Assert.notEmpty(messageConverters, "'messageConverters' must not be empty");
		// Take getMessageConverters() List as-is when passed in here
		if (this.messageConverters != messageConverters) {
			this.messageConverters.clear();
			this.messageConverters.addAll(messageConverters);
		}
	}