mirror of https://github.com/apache/activemq.git
Ensure only one thread dispatches to a session at once
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@381322 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
39b329fc7d
commit
c628313c62
|
@ -176,7 +176,8 @@ namespace OpenWire.Client
|
|||
|
||||
|
||||
// Properties
|
||||
public Connection Connection {
|
||||
public Connection Connection
|
||||
{
|
||||
get {
|
||||
return connection;
|
||||
}
|
||||
|
@ -207,13 +208,20 @@ namespace OpenWire.Client
|
|||
connection.SyncRequest(command);
|
||||
}
|
||||
|
||||
public void DispatchAsyncMessages(object state) {
|
||||
public void DispatchAsyncMessages(object state)
|
||||
{
|
||||
// lets iterate through each consumer created by this session
|
||||
// ensuring that they have all pending messages dispatched
|
||||
foreach (MessageConsumer consumer in consumers.Values) {
|
||||
lock (this)
|
||||
{
|
||||
// lets ensure that only 1 thread dispatches messages in a consumer at once
|
||||
|
||||
foreach (MessageConsumer consumer in consumers.Values)
|
||||
{
|
||||
consumer.DispatchAsyncMessages();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected virtual ConsumerInfo CreateConsumerInfo(IDestination destination, string selector)
|
||||
|
|
Loading…
Reference in New Issue