A batched variant of {@link DefaultMessageListenerContainer#doExecuteListener(Session, Message)}.

@param session The session
@param messages A list of messages
@throws JMSException Indicates a problem during processing
773193
protected void doExecuteListener(Session session, List<Message> messages) throws JMSException {
        if (!isAcceptMessagesWhileStopping() && !isRunning()) {
            if (logger.isWarnEnabled()) {
                logger.warn("Rejecting received messages because of the listener container "
                        + "having been stopped in the meantime: " + messages);
            }
            rollbackIfNecessary(session);
            throw new MessageRejectedWhileStoppingException();
        }

        try {
            for (Message message : messages) {
                invokeListener(session, message);
            }
        } catch (JMSException ex) {
            rollbackOnExceptionIfNecessary(session, ex);
            throw ex;
        } catch (RuntimeException ex) {
            rollbackOnExceptionIfNecessary(session, ex);
            throw ex;
        } catch (Error err) {
            rollbackOnExceptionIfNecessary(session, err);
            throw err;
        }
        commitIfNecessary(session, messages);
    }
349507
@Override
	public final void setJMSMessageID(String id) throws JMSException
    {
    	assertDeserializationLevel(MessageSerializationLevel.FULL);
        this.id = id;
    }
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);
    }
72774
void newMessage(final byte[] message, final Session session) {
        callback.recive(serializer.deserialize(message), session);
    }
195334
protected Session createSession(Connection connection) throws JMSException {
        if (connection instanceof QueueConnection) {
            return ((QueueConnection) connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        }
        return connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    }
732685
@Override
    public void acknowledge(SQSMessage message) throws JMSException {
        session.checkClosed();
        amazonSQSClient.deleteMessage(new DeleteMessageRequest(
                message.getQueueUrl(), message.getReceiptHandle()));
        unAckMessages.remove(message.getReceiptHandle());
    }
1368091
@Override
    public void onMessage(Message message, Session session) throws JMSException {

        StandardLogger logger = LoggerUtil.getStandardLogger();
        try {
            String txt = ((TextMessage) message).getText();
            if (logger.isDebugEnabled()) {
                logger.debug("JMS Spring ExternalEvent Listener receives request: " + txt);
            }
            String resp;
            ListenerHelper helper = new ListenerHelper();
            Map<String, String> metaInfo = new HashMap<String, String>();
            metaInfo.put(Listener.METAINFO_PROTOCOL, Listener.METAINFO_PROTOCOL_JMS);
            metaInfo.put(Listener.METAINFO_REQUEST_PATH, ((Queue)message.getJMSDestination()).getQueueName());
            metaInfo.put(Listener.METAINFO_SERVICE_CLASS, this.getClass().getName());
            metaInfo.put(Listener.METAINFO_REQUEST_ID, message.getJMSMessageID());
            metaInfo.put(Listener.METAINFO_CORRELATION_ID, message.getJMSCorrelationID());
            if (message.getJMSReplyTo() != null)
                metaInfo.put("ReplyTo", message.getJMSReplyTo().toString());

            resp = helper.processEvent(txt, metaInfo);
            String correlId = message.getJMSCorrelationID();

            Queue respQueue = (Queue) message.getJMSReplyTo();
            if (resp != null && respQueue != null) {
                mdwMessageProducer.sendMessage(resp, respQueue, correlId);
                if (logger.isDebugEnabled()) {
                    logger.debug("JMS Listener sends response (corr id='" + correlId + "'): "
                            + resp);
                }

            }

        }
        catch (Throwable ex) {
            logger.severeException(ex.getMessage(), ex);
        }

    }
198700
public void registerMessageListener(MessageListenerDefinition messageListenerDefinition) {
        checkNotNull(messageListenerDefinition);

        ConnectionDefinition connectionDefinition = connectionDefinitions.get(messageListenerDefinition.getConnectionName());
        if (connectionDefinition.isJeeMode() && messageListenerDefinition.getPoller() == null) {
            throw SeedException.createNew(JmsErrorCode.MESSAGE_POLLER_REQUIRED_IN_JEE_MODE)
                    .put(ERROR_CONNECTION_NAME, connectionDefinition.getName())
                    .put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
        }

        try {
            createMessageConsumer(messageListenerDefinition);
        } catch (JMSException e) {
            throw SeedException.wrap(e, JmsErrorCode.UNABLE_TO_CREATE_MESSAGE_CONSUMER)
                    .put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
        }

        if (messageListenerDefinitions.putIfAbsent(messageListenerDefinition.getName(), messageListenerDefinition) != null) {
            throw SeedException.createNew(JmsErrorCode.DUPLICATE_MESSAGE_LISTENER_NAME)
                    .put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
        }
    }
1315591
public void setSessions(java.util.Collection<Session> sessions) {
        if (sessions == null) {
            this.sessions = null;
            return;
        }

        this.sessions = new com.amazonaws.internal.SdkInternalList<Session>(sessions);
    }
1276376
@SuppressWarnings("unchecked")
    private void initSession(SMTPClientSession session) {
        Iterator<SMTPDeliveryEnvelope> transactionList = ((Iterator<SMTPDeliveryEnvelope>) session.getAttribute(SMTP_TRANSACTIONS_KEY));
        SMTPDeliveryEnvelope transaction =  transactionList.next();
        
        session.setAttribute(CURRENT_SMTP_TRANSACTION_KEY,transaction);
        session.setAttribute(RECIPIENTS_KEY, transaction.getRecipients().iterator());
        session.setAttribute(DELIVERY_STATUS_KEY, new ArrayList<DeliveryRecipientStatus>());

        // cleanup old attribute
        session.setAttribute(CURRENT_RCPT_KEY, null);

    }
144249
public final void rollback( boolean rollbackGets, List<String> deliveredMessageIDs ) throws JMSException
    {
    	if (!transacted)
            throw new IllegalStateException("Session is not transacted"); // [JMS SPEC]
    	
    	externalAccessLock.readLock().lock();
    	try
		{
	    	checkNotClosed();
	        rollbackUpdates(true,rollbackGets, deliveredMessageIDs);
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
743740
public static void processMessageToMatchSession(HttpMessage message, HttpSession session) {
		processMessageToMatchSession(message, message.getRequestHeader().getHttpCookies(), session);
	}
866610
@Test
    public void message_polling_is_working() throws JMSException {
        testSender4.send("HELLO");

        try {
            count.await(5, TimeUnit.SECONDS);

            Assertions.assertThat(text).isEqualTo("HELLO");
        } catch (InterruptedException e) {
            fail("Thread interrupted");
        }
    }
446941
@Override
    public void onMessage(Message message) {
        StandardLogger logger = LoggerUtil.getStandardLogger();
        String logtag = "EngineDriver.T" + Thread.currentThread().getId() + " - ";

        try {
            String txt = ((TextMessage) message).getText();
            if (logger.isDebugEnabled()) {
                logger.debug("JMS Spring InternalEvent Listener receives request: " + txt);
            }
            logger.info(logtag + "starts processing");
            String messageId = message.getJMSCorrelationID();
            ProcessEngineDriver driver = new ProcessEngineDriver();
            driver.processEvents(messageId, txt);
        } catch (Throwable e) { // only possible when failed to get ProcessManager ejb
            logger.severeException(logtag + "process exception " + e.getMessage(), e);
        }

    }
252078
@Override
    public boolean putLocked(AbstractMessage message, LocalSession session, MessageLockSet locks) throws JMSException
    {
    	checkNotClosed();
    	checkTransactionLock();
    	
    	// Consistency check
    	if (!message.isInternalCopy())
    		throw new FFMQException("Message instance is not an FFMQ internal copy !","CONSISTENCY_ERROR");
    	
    	// Dispatch message to the adequate store
    	MessageStore targetStore;
    	if (message.getJMSDeliveryMode() == DeliveryMode.NON_PERSISTENT)
    	{
    	    // Use volatile store if possible, otherwise fallback to persistent store
    	    targetStore = volatileStore != null ? volatileStore : persistentStore;
    	}
    	else
    	    targetStore = persistentStore;
    	    
    	if (targetStore == null)
    	    throw new FFMQException("Queue does not support this delivery mode : "+
    	                            (message.getJMSDeliveryMode() == DeliveryMode.NON_PERSISTENT ? 
    	                            "DeliveryMode.NON_PERSISTENT" : "DeliveryMode.PERSISTENT"),
    	                            "INVALID_DELIVERY_MODE");
    	
    	int newHandle;
        synchronized (storeLock)
        {
            newHandle = targetStore.store(message);
            if (newHandle == -1)
            {
            	// No space left for this message in the target store
            	if (targetStore == volatileStore && persistentStore != null && queueDef.isOverflowToPersistent())
            	{
            		// Fallback to persistent store if possible
            		targetStore = persistentStore;
            		newHandle = targetStore.store(message);
            	}
 
            	// Cannot store the message anywhere
            	if (newHandle == -1)
            		throw new DataStoreFullException("Cannot store message : queue is full : "+getName());
            }
            
            targetStore.lock(newHandle);
        	locks.add(newHandle, targetStore.getDeliveryMode(), this, message);
        }
        
        if (message.getJMSDeliveryMode() == DeliveryMode.PERSISTENT && requiresTransactionalUpdate())
        {
        	pendingChanges = true;
        	return true;
        }
        else
        	return false;
    }
1368887
@Override
	public void setMessageListener(MessageListener messageListener) throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
    		checkNotClosed();
    		this.messageListener = messageListener;
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
356046
@Override
    public Message createMessage(Session session) throws JMSException {
        Message message = session.createTextMessage(requestMessage);
        if (correlationId != null)
            message.setJMSCorrelationID(correlationId);
        if (replyQueue != null) {
            message.setJMSReplyTo(replyQueue);
        }
        if (delaySeconds >0) {
            ApplicationContext.getJmsProvider().setMessageDelay(null, message, delaySeconds);
        }
        return message;
    }