[ 
https://issues.apache.org/activemq/browse/AMQ-1187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39555
 ] 

Manuel Teira commented on AMQ-1187:
-----------------------------------

Hello.
I think the problem is that you're using the same Session object from different 
threads. This is not the intended usage, if you read the JMS API Specification, 
it says:

A Session object is a single-threaded context for producing and consuming 
messages. Although it may allocate provider resources outside the Java virtual 
machine (JVM), it is considered a lightweight JMS object.

and also:

Once a connection has been started, any session with one or more registered 
message listeners is dedicated to the thread of control that delivers messages 
to it. It is erroneous for client code to use this session or any of its 
constituent objects from another thread of control. The only exception to this 
rule is the use of the session or connection close method.

What I deduce from this, is that you need a different session for any of your 
producer and consumer threads.





> Messages sent in parallel threads may not be enqueued
> -----------------------------------------------------
>
>                 Key: AMQ-1187
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1187
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 4.0.2, 4.1.0
>         Environment: Linux 
>            Reporter: Philippe Göllnitz
>         Attachments: console.txt, jconsole.png, TestMqBroker.java, 
> TestMqBroker2.java
>
>
> I sent 1000 messages in own threads but monitoring the queue with jconsole 
> sometimes only 999 are in the queue. 
> This happens more likely if you raise the number of sent messages 10.000 or 
> 100.000 but can also happen if set to 100.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to