简体   繁体   中英

Can a single QueueConnection be used in multithreaded environment.?

I have a IBM QM that is configured in IBM WAS. A single QueueConnection is created from QCF and is loaded into memory, so that multiple threads can access the same connection(each thread will create a session out this conn) to send and receive messages from Queue. I have a performance issue with this approach.

  1. While first thread is using the connection, will other threads wait until the first send and receive.?
  2. If this is the case can I create a connection for each thread.? Will this affect performance.?

I have an application where no.of concurrent requests will be 50 per sec. So I have to deal with the performance issue.

Any help will be appreciated.

JMS connections (ie QueueConnections and TopicConnections) are thread safe and can be used by multiple threads. All JMS constructs "below" a connection (ie Sessions, QueueSessions, TopicSessions) are not, and one should be allocated per thread.

Each thread should be sharing a QueueConnectionFactory rather than a QueueConnection.

Threads will then create their own QueueConnection from the factory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM