From a47a11af6aaab04c0949879c138ffbd1f696ea76 Mon Sep 17 00:00:00 2001 From: Shad Storhaug Date: Mon, 11 Mar 2024 01:39:34 +0700 Subject: [PATCH] SWEEP: Reviewed all applications of .GetAndAdd() methods from atomic numeric classes --- src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs | 4 ++-- src/Lucene.Net.Tests/Search/TestBooleanOr.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs index dc226fa691..0c756b4b7c 100644 --- a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs +++ b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs @@ -704,7 +704,7 @@ public override IndexOutput CreateOutput(string name, IOContext context) { if (existing != null) { - ramdir.m_sizeInBytes.AddAndGet(-existing.GetSizeInBytes()); // LUCENENET: GetAndAdd in Lucene, but we are not using the value + ramdir.m_sizeInBytes.GetAndAdd(-existing.GetSizeInBytes()); existing.directory = null; } ramdir.m_fileMap[name] = file; @@ -1558,4 +1558,4 @@ protected FakeIOException(SerializationInfo info, StreamingContext context) } #endif } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests/Search/TestBooleanOr.cs b/src/Lucene.Net.Tests/Search/TestBooleanOr.cs index 74971e4288..243be1e397 100644 --- a/src/Lucene.Net.Tests/Search/TestBooleanOr.cs +++ b/src/Lucene.Net.Tests/Search/TestBooleanOr.cs @@ -205,7 +205,7 @@ public virtual void TestBooleanScorerMax() while (end.Value < docCount) { int inc = TestUtil.NextInt32(Random, 1, 1000); - end.AddAndGet(inc); + end.GetAndAdd(inc); scorer.Score(c, end); }