You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrate test CountdownEvent usage to Java-style CountDownLatch, #1284
Replaces System.Threading.CountdownEvent with the new
Lucene.Net.Support.Threading.CountDownLatch across 22 test files where
the upstream Java equivalent uses java.util.concurrent.CountDownLatch.
Mechanical changes:
- type rename: CountdownEvent -> CountDownLatch
- .Signal() -> .CountDown()
- .Wait() / .Wait(TimeSpan) -> .Await() / .Await(TimeSpan)
- .CurrentCount -> .Count
- .IsSet -> .Count == 0
- added using Lucene.Net.Support.Threading where needed
Workarounds for CountdownEvent.Signal()'s "throws past zero" behavior
that are now redundant (CountDown is idempotent at zero, matching Java):
- TestConcurrentMergeScheduler.TestMaxMergeCount: removed the
CurrentCount > 0 guard. This was the trigger for the CI failure on
Windows .NET Framework and Ubuntu .NET 8 after the LUCENE-5871 port
made Shutdown(false) flush more aggressively.
- TestIndexWriterWithThreads: removed the same pre-existing guard at
iwConstructed.
- TestDocumentsWriterStallControl: removed if (!updateJoin.IsSet)
guard around CountDown(); upstream calls countDown() unconditionally.
- TestControlledRealTimeReopenThread: replaced two
signal.Reset(Count - 1)/latch.Reset(Count - 1) hacks with plain
CountDown(), matching upstream signal.countDown()/latch.countDown().
Other adjustments:
- BaseDocValuesFormatTestCase: dropped `using` keyword on two latches.
CountdownEvent was IDisposable; CountDownLatch isn't (Java's isn't
either), so the latches now go out of scope without explicit cleanup.
- TestControlledRealTimeReopenThread.LatchedIndexWriter: ctor changed
from public to internal so CountDownLatch (internal) is reachable
from a public class member.
Files touched: 22 test files plus 2 in TestFramework. All ported sites
now read the same as the upstream Java; no LUCENENET notes were added
because the code is now equivalent.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments