Author: jgomes
Date: Tue Sep 20 00:12:20 2011
New Revision: 1172915
URL: http://svn.apache.org/viewvc?rev=1172915&view=rev
Log:
Merged revision(s) 1172914 from
activemq/activemq-dotnet/Apache.NMS.EMS/branches/1.5.x:
Fix a spurious bug in the close consumer code. The EMS client has a race
condition when unregistering a message handler and then closing the consumer.
If it happens slowly, then it works correctly. If it happens at full speed,
then an exception is thrown. The solution is to not unregister the delegate.
Since the consumer is being destroyed anyway, this is a safe thing to (not) do.
Updated the MapMessage API to remove calls to obsolete APIs.
Added new response temp queue unit test.
........
Added:
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/test/csharp/ReqResponseTempQueue.cs
- copied unchanged from r1172914,
activemq/activemq-dotnet/Apache.NMS.EMS/branches/1.5.x/src/test/csharp/ReqResponseTempQueue.cs
Modified:
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/ (props changed)
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageConsumer.cs
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems-test.csproj
(contents, props changed)
Propchange: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Sep 20 00:12:20 2011
@@ -0,0 +1 @@
+/activemq/activemq-dotnet/Apache.NMS.EMS/branches/1.5.x:1172914
Modified:
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs?rev=1172915&r1=1172914&r2=1172915&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs
Tue Sep 20 00:12:20 2011
@@ -87,16 +87,14 @@ namespace Apache.NMS.EMS
get
{
int count = 0;
+
try
{
- IEnumerator namesEnumerator =
this.tibcoMapMessage.MapNames;
+ ICollection mapNames =
this.tibcoMapMessage.GetMapNames();
- if(null != namesEnumerator)
+ if(null != mapNames)
{
-
while(namesEnumerator.MoveNext())
- {
- count++;
- }
+ count = mapNames.Count;
}
}
catch(Exception ex)
@@ -116,7 +114,7 @@ namespace Apache.NMS.EMS
try
{
- foreach(string itemName in
EMSConvert.ToEnumerable(this.tibcoMapMessage.MapNames))
+ foreach(string itemName in
this.tibcoMapMessage.GetMapNames())
{
keys.Add(itemName);
}
@@ -138,7 +136,7 @@ namespace Apache.NMS.EMS
try
{
- foreach(string itemName in
EMSConvert.ToEnumerable(this.tibcoMapMessage.MapNames))
+ foreach(string itemName in
this.tibcoMapMessage.GetMapNames())
{
keys.Add(this.tibcoMapMessage.GetObject(itemName));
}
Modified:
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageConsumer.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageConsumer.cs?rev=1172915&r1=1172914&r2=1172915&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageConsumer.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageConsumer.cs
Tue Sep 20 00:12:20 2011
@@ -108,7 +108,16 @@ namespace Apache.NMS.EMS
{
if(!this.nmsSession.tibcoSession.IsClosed)
{
-
this.tibcoMessageConsumer.MessageHandler -= this.HandleTibcoMsg;
+ // JGomes: Calling the
following message handler removal code creates an
+ // instability in the TIBCO
consumer and will fail to unregister a consumer.
+ // This is a very odd bug, but
it has been observed that unregistering the
+ // message handler is not
necessary and can be harmful. When the unregister is
+ // executed slowly step-by-step
under a debugger, then it works correctly. When
+ // it is run full speed, it
creates a race condition. Therefore, the code is left
+ // here in a commented out
state to demonstrate what normal cleanup code should
+ // look like, but don't
uncomment it.
+
+ //
this.tibcoMessageConsumer.MessageHandler -= this.HandleTibcoMsg;
this.tibcoMessageConsumer.Close();
}
}
Modified: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems-test.csproj
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems-test.csproj?rev=1172915&r1=1172914&r2=1172915&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems-test.csproj
(original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems-test.csproj Tue
Sep 20 00:12:20 2011
@@ -75,6 +75,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="src\test\csharp\CommonAssemblyInfo.cs" />
+ <Compile Include="src\test\csharp\ReqResponseTempQueue.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="vs2008-ems.csproj">
Propchange: activemq/activemq-dotnet/Apache.NMS.EMS/trunk/vs2008-ems-test.csproj
('svn:mergeinfo' removed)