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
|
@ -112,7 +112,7 @@ namespace OpenWire.Client
|
|||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public IQueue GetQueue(string name)
|
||||
{
|
||||
return new ActiveMQQueue(name);
|
||||
|
@ -176,7 +176,8 @@ namespace OpenWire.Client
|
|||
|
||||
|
||||
// Properties
|
||||
public Connection Connection {
|
||||
public Connection Connection
|
||||
{
|
||||
get {
|
||||
return connection;
|
||||
}
|
||||
|
@ -207,11 +208,18 @@ 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) {
|
||||
consumer.DispatchAsyncMessages();
|
||||
lock (this)
|
||||
{
|
||||
// lets ensure that only 1 thread dispatches messages in a consumer at once
|
||||
|
||||
foreach (MessageConsumer consumer in consumers.Values)
|
||||
{
|
||||
consumer.DispatchAsyncMessages();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue