This is an automated email from the ASF dual-hosted git repository.
tabish pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton-dotnet.git
The following commit(s) were added to refs/heads/main by this push:
new 8ea1ccd PROTON-2621 Use concurrent type explicitly to avoid threading
issue
8ea1ccd is described below
commit 8ea1ccde0c4bd5db135e7e246bc63ba0ce9bd60f
Author: Timothy Bish <[email protected]>
AuthorDate: Tue Oct 11 14:13:26 2022 -0400
PROTON-2621 Use concurrent type explicitly to avoid threading issue
Use the concurrent dictionary type explicitly to avoid the use of the
extension method which calls the not thread safe dictionary add method
instead of the implementation specific TryAdd API.
---
src/Proton/Types/Symbol.cs | 7 ++-----
test/Proton.Tests/Types/SymbolTest.cs | 4 ++--
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/Proton/Types/Symbol.cs b/src/Proton/Types/Symbol.cs
index 66c781a..fdd980d 100644
--- a/src/Proton/Types/Symbol.cs
+++ b/src/Proton/Types/Symbol.cs
@@ -18,17 +18,14 @@
using Apache.Qpid.Proton.Buffer;
using System;
using System.Text;
-using System.Collections.Generic;
using System.Collections.Concurrent;
namespace Apache.Qpid.Proton.Types
{
public sealed class Symbol : IEquatable<Symbol>, IComparable,
IComparable<Symbol>
{
- private static readonly IDictionary<IProtonBuffer, Symbol>
buffersToSymbols =
- new ConcurrentDictionary<IProtonBuffer, Symbol>();
- private static readonly IDictionary<string, Symbol> stringsToSymbols =
- new ConcurrentDictionary<string, Symbol>();
+ private static readonly ConcurrentDictionary<IProtonBuffer, Symbol>
buffersToSymbols = new();
+ private static readonly ConcurrentDictionary<string, Symbol>
stringsToSymbols = new();
private static readonly Symbol EMPTY_SYMBOL = new();
diff --git a/test/Proton.Tests/Types/SymbolTest.cs
b/test/Proton.Tests/Types/SymbolTest.cs
index 72990d3..49dae36 100644
--- a/test/Proton.Tests/Types/SymbolTest.cs
+++ b/test/Proton.Tests/Types/SymbolTest.cs
@@ -112,7 +112,7 @@ namespace Apache.Qpid.Proton.Types
}
[Test]
- public void TestHashcode()
+ public void TestHashCode()
{
string symbolString1 = "Symbol-1";
string symbolString2 = "Symbol-2";
@@ -200,7 +200,7 @@ namespace Apache.Qpid.Proton.Types
}
[Test]
- public void TestToStringProducesSingelton()
+ public void TestToStringProducesSingleton()
{
string symbolString = "Symbol-string";
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]