You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2016/04/24 00:27:37 UTC
[3/4] lucenenet git commit: Removing Apache.NMS dependency.
Removing Apache.NMS dependency.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/69592a68
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/69592a68
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/69592a68
Branch: refs/heads/master
Commit: 69592a680bb159b2daab726e19d250770f520d8d
Parents: a5e8c8b
Author: EMaher <en...@microsoft.com>
Authored: Thu Apr 21 16:29:01 2016 -0700
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Sun Apr 24 01:25:58 2016 +0300
----------------------------------------------------------------------
.gitignore | 1 +
src/Lucene.Net.Core/Lucene.Net.csproj | 1 +
src/Lucene.Net.Core/Support/AtomicObject.cs | 39 ++++++++++++++++++
.../Analysis/BaseTokenStreamTestCase.cs | 11 +++--
.../Index/BaseDocValuesFormatTestCase.cs | 22 +++++-----
.../Index/BaseStoredFieldsFormatTestCase.cs | 11 +++--
.../Index/BaseTermVectorsFormatTestCase.cs | 9 ++--
.../Lucene.Net.TestFramework.csproj | 6 ---
src/Lucene.Net.TestFramework/packages.config | 1 -
.../AssertingSubDocsAtOnceCollector.cs | 5 +--
.../Lucene.Net.Tests.Facet.csproj | 3 --
.../Taxonomy/TestSearcherTaxonomyManager.cs | 3 +-
src/Lucene.Net.Tests.Facet/packages.config | 1 -
.../Lucene.Net.Tests.Join.csproj | 4 --
.../TestBlockJoinValidation.cs | 1 -
src/Lucene.Net.Tests.Join/packages.config | 1 -
src/Lucene.Net.Tests/Lucene.Net.Tests.csproj | 7 ----
.../core/Index/TestBagOfPositions.cs | 12 +++---
.../core/Index/TestBagOfPostings.cs | 12 +++---
.../core/Index/TestBinaryDocValuesUpdates.cs | 12 +++---
.../core/Index/TestConcurrentMergeScheduler.cs | 13 +++---
.../core/Index/TestDocValuesIndexing.cs | 12 +++---
.../core/Index/TestDocValuesWithThreads.cs | 12 +++---
.../Index/TestDocumentsWriterDeleteQueue.cs | 11 +++--
.../Index/TestDocumentsWriterStallControl.cs | 43 ++++++++++----------
.../core/Index/TestIndexWriterDelete.cs | 19 ++++-----
.../core/Index/TestIndexWriterNRTIsCurrent.cs | 17 ++++----
.../core/Index/TestIndexWriterWithThreads.cs | 38 ++++++++---------
.../core/Index/TestMixedDocValuesUpdates.cs | 12 +++---
.../core/Index/TestNumericDocValuesUpdates.cs | 12 +++---
.../core/Search/TestAutomatonQuery.cs | 12 +++---
.../core/Search/TestLiveFieldValues.cs | 12 +++---
.../core/Search/TestSameScoresWithThreads.cs | 12 +++---
.../core/Search/TestSearcherManager.cs | 19 ++++-----
src/Lucene.Net.Tests/packages.config | 1 -
35 files changed, 206 insertions(+), 201 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 27e2d1b..1179779 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,3 +33,4 @@ obj/
doc/
src/demo/
packages/
+TestResults/
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Core/Lucene.Net.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.csproj b/src/Lucene.Net.Core/Lucene.Net.csproj
index 5d573a0..6ae9fd2 100644
--- a/src/Lucene.Net.Core/Lucene.Net.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.csproj
@@ -606,6 +606,7 @@
<Compile Include="Support\AtomicBoolean.cs" />
<Compile Include="Support\AtomicInteger.cs" />
<Compile Include="Support\AtomicLong.cs" />
+ <Compile Include="Support\AtomicObject.cs" />
<Compile Include="Support\Buffer.cs" />
<Compile Include="Support\AttributeImplItem.cs" />
<Compile Include="Support\BitSetSupport.cs" />
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Core/Support/AtomicObject.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/AtomicObject.cs b/src/Lucene.Net.Core/Support/AtomicObject.cs
new file mode 100644
index 0000000..dfa83dc
--- /dev/null
+++ b/src/Lucene.Net.Core/Support/AtomicObject.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Threading;
+
+namespace Lucene.Net.Support
+{
+ public class AtomicObject<T> where T : class
+ {
+ private T _value;
+ private ReaderWriterLockSlim _lock = new ReaderWriterLockSlim();
+
+ public AtomicObject() : this(default(T))
+ { }
+
+ public AtomicObject(T initial)
+ {
+ _value = initial;
+ }
+
+ public T Value
+ {
+ get
+ {
+ try
+ {
+ _lock.EnterReadLock();
+ return _value;
+ }
+ finally
+ {
+ _lock.ExitReadLock();
+ }
+ }
+ set
+ {
+ Interlocked.Exchange(ref _value, value);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
index 9dbd673..bb1098c 100644
--- a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
@@ -1,5 +1,4 @@
using System.Linq;
-using Apache.NMS.Util;
using Lucene.Net.Documents;
using Lucene.Net.Index;
using NUnit.Framework;
@@ -560,14 +559,14 @@ namespace Lucene.Net.Analysis
internal readonly bool Simple;
internal readonly bool OffsetsAreCorrect;
internal readonly RandomIndexWriter Iw;
- private readonly CountDownLatch _latch;
+ private readonly CountdownEvent _latch;
// NOTE: not volatile because we don't want the tests to
// add memory barriers (ie alter how threads
// interact)... so this is just "best effort":
public bool Failed;
- internal AnalysisThread(long seed, /*CountDownLatch latch,*/ Analyzer a, int iterations, int maxWordLength, bool useCharFilter, bool simple, bool offsetsAreCorrect, RandomIndexWriter iw)
+ internal AnalysisThread(long seed, /*CountdownEvent latch,*/ Analyzer a, int iterations, int maxWordLength, bool useCharFilter, bool simple, bool offsetsAreCorrect, RandomIndexWriter iw)
{
this.Seed = seed;
this.a = a;
@@ -585,7 +584,7 @@ namespace Lucene.Net.Analysis
bool success = false;
try
{
- if (_latch != null) _latch.await();
+ if (_latch != null) _latch.Wait();
// see the part in checkRandomData where it replays the same text again
// to verify reproducability/reuse: hopefully this would catch thread hazards.
CheckRandomData(new Random((int)Seed), a, Iterations, MaxWordLength, UseCharFilter, Simple, OffsetsAreCorrect, Iw);
@@ -631,7 +630,7 @@ namespace Lucene.Net.Analysis
// now test with multiple threads: note we do the EXACT same thing we did before in each thread,
// so this should only really fail from another thread if its an actual thread problem
int numThreads = TestUtil.NextInt(random, 2, 4);
- var startingGun = new CountDownLatch(1);
+ var startingGun = new CountdownEvent(1);
var threads = new AnalysisThread[numThreads];
for (int i = 0; i < threads.Length; i++)
{
@@ -640,7 +639,7 @@ namespace Lucene.Net.Analysis
Array.ForEach(threads, thread => thread.Start());
- startingGun.countDown();
+ startingGun.Signal();
foreach (var t in threads)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
index ae7e1fc..9be51c3 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
@@ -1,9 +1,9 @@
-using Apache.NMS.Util;
using Lucene.Net.Documents;
using Lucene.Net.Randomized.Generators;
using System;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Threading;
using Lucene.Net.Search;
namespace Lucene.Net.Index
@@ -3209,14 +3209,14 @@ namespace Lucene.Net.Index
DirectoryReader ir = DirectoryReader.Open(dir);
int numThreads = TestUtil.NextInt(Random(), 2, 7);
ThreadClass[] threads = new ThreadClass[numThreads];
- CountDownLatch startingGun = new CountDownLatch(1);
+ CountdownEvent startingGun = new CountdownEvent(1);
for (int i = 0; i < threads.Length; i++)
{
threads[i] = new ThreadAnonymousInnerClassHelper(this, ir, startingGun);
threads[i].Start();
}
- startingGun.countDown();
+ startingGun.Signal();
foreach (ThreadClass t in threads)
{
t.Join();
@@ -3230,9 +3230,9 @@ namespace Lucene.Net.Index
private readonly BaseDocValuesFormatTestCase OuterInstance;
private DirectoryReader Ir;
- private CountDownLatch StartingGun;
+ private CountdownEvent StartingGun;
- public ThreadAnonymousInnerClassHelper(BaseDocValuesFormatTestCase outerInstance, DirectoryReader ir, CountDownLatch startingGun)
+ public ThreadAnonymousInnerClassHelper(BaseDocValuesFormatTestCase outerInstance, DirectoryReader ir, CountdownEvent startingGun)
{
this.OuterInstance = outerInstance;
this.Ir = ir;
@@ -3243,7 +3243,7 @@ namespace Lucene.Net.Index
{
try
{
- StartingGun.@await();
+ StartingGun.Wait();
foreach (AtomicReaderContext context in Ir.Leaves)
{
AtomicReader r = context.AtomicReader;
@@ -3347,14 +3347,14 @@ namespace Lucene.Net.Index
DirectoryReader ir = DirectoryReader.Open(dir);
int numThreads = TestUtil.NextInt(Random(), 2, 7);
ThreadClass[] threads = new ThreadClass[numThreads];
- CountDownLatch startingGun = new CountDownLatch(1);
+ CountdownEvent startingGun = new CountdownEvent(1);
for (int i = 0; i < threads.Length; i++)
{
threads[i] = new ThreadAnonymousInnerClassHelper2(this, ir, startingGun);
threads[i].Start();
}
- startingGun.countDown();
+ startingGun.Signal();
foreach (ThreadClass t in threads)
{
t.Join();
@@ -3368,9 +3368,9 @@ namespace Lucene.Net.Index
private readonly BaseDocValuesFormatTestCase OuterInstance;
private DirectoryReader Ir;
- private CountDownLatch StartingGun;
+ private CountdownEvent StartingGun;
- public ThreadAnonymousInnerClassHelper2(BaseDocValuesFormatTestCase outerInstance, DirectoryReader ir, CountDownLatch startingGun)
+ public ThreadAnonymousInnerClassHelper2(BaseDocValuesFormatTestCase outerInstance, DirectoryReader ir, CountdownEvent startingGun)
{
this.OuterInstance = outerInstance;
this.Ir = ir;
@@ -3381,7 +3381,7 @@ namespace Lucene.Net.Index
{
try
{
- StartingGun.@await();
+ StartingGun.Wait();
foreach (AtomicReaderContext context in Ir.Leaves)
{
AtomicReader r = context.AtomicReader;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
index 6f202a5..db140dd 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
@@ -1,4 +1,3 @@
-using Apache.NMS.Util;
using Lucene.Net.Attributes;
using Lucene.Net.Codecs;
using Lucene.Net.Documents;
@@ -10,6 +9,7 @@ using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Threading;
namespace Lucene.Net.Index
{
@@ -472,7 +472,7 @@ namespace Lucene.Net.Index
int concurrentReads = AtLeast(5);
int readsPerThread = AtLeast(50);
IList<ThreadClass> readThreads = new List<ThreadClass>();
- AtomicReference<Exception> ex = new AtomicReference<Exception>();
+ AtomicObject<Exception> ex = new AtomicObject<Exception>();
for (int i = 0; i < concurrentReads; ++i)
{
readThreads.Add(new ThreadAnonymousInnerClassHelper(numDocs, rd, searcher, readsPerThread, ex, i));
@@ -501,11 +501,11 @@ namespace Lucene.Net.Index
private readonly DirectoryReader Rd;
private readonly IndexSearcher Searcher;
private int ReadsPerThread;
- private AtomicReference<Exception> Ex;
+ private AtomicObject<Exception> Ex;
private int i;
private readonly int[] queries;
- public ThreadAnonymousInnerClassHelper(int numDocs, DirectoryReader rd, IndexSearcher searcher, int readsPerThread, AtomicReference<Exception> ex, int i)
+ public ThreadAnonymousInnerClassHelper(int numDocs, DirectoryReader rd, IndexSearcher searcher, int readsPerThread, AtomicObject<Exception> ex, int i)
{
this.NumDocs = numDocs;
this.Rd = rd;
@@ -546,8 +546,7 @@ namespace Lucene.Net.Index
}
catch (Exception e)
{
- Ex.GetAndSet(e);
- //Ex.compareAndSet(null, e);
+ Ex.Value = e;
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
index 54c689d..d48b6f8 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
@@ -1,4 +1,3 @@
-using Apache.NMS.Util;
using Lucene.Net.Analysis.Tokenattributes;
using System;
using System.Collections.Generic;
@@ -890,7 +889,7 @@ namespace Lucene.Net.Index
AssertEquals(docs[i], reader.GetTermVectors(docID));
}
- AtomicReference<Exception> exception = new AtomicReference<Exception>();
+ AtomicObject<Exception> exception = new AtomicObject<Exception>();
ThreadClass[] threads = new ThreadClass[2];
for (int i = 0; i < threads.Length; ++i)
{
@@ -918,10 +917,10 @@ namespace Lucene.Net.Index
private int NumDocs;
private Lucene.Net.Index.BaseTermVectorsFormatTestCase.RandomDocument[] Docs;
private IndexReader Reader;
- private AtomicReference<Exception> ARException;
+ private AtomicObject<Exception> ARException;
private int i;
- public ThreadAnonymousInnerClassHelper(BaseTermVectorsFormatTestCase outerInstance, int numDocs, Lucene.Net.Index.BaseTermVectorsFormatTestCase.RandomDocument[] docs, IndexReader reader, AtomicReference<Exception> exception, int i)
+ public ThreadAnonymousInnerClassHelper(BaseTermVectorsFormatTestCase outerInstance, int numDocs, Lucene.Net.Index.BaseTermVectorsFormatTestCase.RandomDocument[] docs, IndexReader reader, AtomicObject<Exception> exception, int i)
{
this.OuterInstance = outerInstance;
this.NumDocs = numDocs;
@@ -944,7 +943,7 @@ namespace Lucene.Net.Index
}
catch (Exception t)
{
- ARException.Value = t;
+ this.ARException.Value = t;
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
index dfc076b..a4390b4 100644
--- a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
+++ b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
@@ -43,12 +43,6 @@
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Apache.NMS">
- <HintPath>..\..\packages\Apache.NMS.1.6.0.3083\lib\net40\Apache.NMS.dll</HintPath>
- </Reference>
- <Reference Include="ICSharpCode.SharpZipLib">
- <HintPath>..\..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
- </Reference>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
</Reference>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.TestFramework/packages.config
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/packages.config b/src/Lucene.Net.TestFramework/packages.config
index ffa0c4a..7a698ab 100644
--- a/src/Lucene.Net.TestFramework/packages.config
+++ b/src/Lucene.Net.TestFramework/packages.config
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Apache.NMS" version="1.6.0.3083" targetFramework="net40" />
<package id="NUnit" version="2.6.3" targetFramework="net40" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net40" />
</packages>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests.Facet/AssertingSubDocsAtOnceCollector.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/AssertingSubDocsAtOnceCollector.cs b/src/Lucene.Net.Tests.Facet/AssertingSubDocsAtOnceCollector.cs
index c3730df..ed2749d 100644
--- a/src/Lucene.Net.Tests.Facet/AssertingSubDocsAtOnceCollector.cs
+++ b/src/Lucene.Net.Tests.Facet/AssertingSubDocsAtOnceCollector.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using Apache.NMS;
namespace Lucene.Net.Facet
{
@@ -26,7 +25,7 @@ namespace Lucene.Net.Facet
using Collector = Lucene.Net.Search.Collector;
using ChildScorer = Lucene.Net.Search.Scorer.ChildScorer;
using Scorer = Lucene.Net.Search.Scorer;
-
+ using System;
/// <summary>
/// Verifies in collect() that all child subScorers are on
/// the collected doc.
@@ -63,7 +62,7 @@ namespace Lucene.Net.Facet
{
if (docID != s.DocID())
{
- throw new IllegalStateException("subScorer=" + s + " has docID=" + s.DocID() + " != collected docID=" + docID);
+ throw new InvalidOperationException("subScorer=" + s + " has docID=" + s.DocID() + " != collected docID=" + docID);
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests.Facet/Lucene.Net.Tests.Facet.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Lucene.Net.Tests.Facet.csproj b/src/Lucene.Net.Tests.Facet/Lucene.Net.Tests.Facet.csproj
index 6d95c42..767e3d0 100644
--- a/src/Lucene.Net.Tests.Facet/Lucene.Net.Tests.Facet.csproj
+++ b/src/Lucene.Net.Tests.Facet/Lucene.Net.Tests.Facet.csproj
@@ -30,9 +30,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Apache.NMS">
- <HintPath>..\..\packages\Apache.NMS.1.6.0.3083\lib\net40\Apache.NMS.dll</HintPath>
- </Reference>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
</Reference>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs
index dd93d18..b0a1277 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using System.Threading;
-using Apache.NMS;
using Lucene.Net.Support;
using NUnit.Framework;
@@ -339,7 +338,7 @@ namespace Lucene.Net.Facet.Taxonomy
mgr.MaybeRefresh();
Fail("should have hit exception");
}
- catch (IllegalStateException)
+ catch (InvalidOperationException)
{
// expected
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests.Facet/packages.config
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/packages.config b/src/Lucene.Net.Tests.Facet/packages.config
index f0ed309..139d513 100644
--- a/src/Lucene.Net.Tests.Facet/packages.config
+++ b/src/Lucene.Net.Tests.Facet/packages.config
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Apache.NMS" version="1.6.0.3083" targetFramework="net451" />
<package id="NUnit" version="2.6.3" targetFramework="net451" />
</packages>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests.Join/Lucene.Net.Tests.Join.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Join/Lucene.Net.Tests.Join.csproj b/src/Lucene.Net.Tests.Join/Lucene.Net.Tests.Join.csproj
index d6cd6d1..312fbdd 100644
--- a/src/Lucene.Net.Tests.Join/Lucene.Net.Tests.Join.csproj
+++ b/src/Lucene.Net.Tests.Join/Lucene.Net.Tests.Join.csproj
@@ -30,10 +30,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Apache.NMS, Version=1.6.0.3083, Culture=neutral, PublicKeyToken=82756feee3957618, processorArchitecture=MSIL">
- <HintPath>..\packages\Apache.NMS.1.6.0.3083\lib\net40\Apache.NMS.dll</HintPath>
- <Private>True</Private>
- </Reference>
<Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests.Join/TestBlockJoinValidation.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Join/TestBlockJoinValidation.cs b/src/Lucene.Net.Tests.Join/TestBlockJoinValidation.cs
index 5fdd35f..637cd4a 100644
--- a/src/Lucene.Net.Tests.Join/TestBlockJoinValidation.cs
+++ b/src/Lucene.Net.Tests.Join/TestBlockJoinValidation.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
-using Apache.NMS;
using Lucene.Net.Analysis;
using Lucene.Net.Documents;
using Lucene.Net.Index;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests.Join/packages.config
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Join/packages.config b/src/Lucene.Net.Tests.Join/packages.config
index f0ed309..139d513 100644
--- a/src/Lucene.Net.Tests.Join/packages.config
+++ b/src/Lucene.Net.Tests.Join/packages.config
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Apache.NMS" version="1.6.0.3083" targetFramework="net451" />
<package id="NUnit" version="2.6.3" targetFramework="net451" />
</packages>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index 6be5a97..c4982ab 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -38,13 +38,6 @@
<StartupObject />
</PropertyGroup>
<ItemGroup>
- <Reference Include="Apache.NMS">
- <HintPath>..\..\packages\Apache.NMS.1.6.0.3083\lib\net40\Apache.NMS.dll</HintPath>
- </Reference>
- <Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
- </Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Index/TestBagOfPositions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestBagOfPositions.cs b/src/Lucene.Net.Tests/core/Index/TestBagOfPositions.cs
index e7cf985..12cdc72 100644
--- a/src/Lucene.Net.Tests/core/Index/TestBagOfPositions.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestBagOfPositions.cs
@@ -1,8 +1,8 @@
-using Apache.NMS.Util;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Text;
+using System.Threading;
using Lucene.Net.Documents;
namespace Lucene.Net.Index
@@ -109,7 +109,7 @@ namespace Lucene.Net.Index
// else just positions
ThreadClass[] threads = new ThreadClass[threadCount];
- CountDownLatch startingGun = new CountDownLatch(1);
+ CountdownEvent startingGun = new CountdownEvent(1);
for (int threadID = 0; threadID < threadCount; threadID++)
{
@@ -120,7 +120,7 @@ namespace Lucene.Net.Index
threads[threadID] = new ThreadAnonymousInnerClassHelper(this, numTerms, maxTermsPerDoc, postings, iw, startingGun, threadRandom, document, field);
threads[threadID].Start();
}
- startingGun.countDown();
+ startingGun.Signal();
foreach (ThreadClass t in threads)
{
t.Join();
@@ -156,12 +156,12 @@ namespace Lucene.Net.Index
private int MaxTermsPerDoc;
private ConcurrentQueue<string> Postings;
private RandomIndexWriter Iw;
- private CountDownLatch StartingGun;
+ private CountdownEvent StartingGun;
private Random ThreadRandom;
private Document Document;
private Field Field;
- public ThreadAnonymousInnerClassHelper(TestBagOfPositions outerInstance, int numTerms, int maxTermsPerDoc, ConcurrentQueue<string> postings, RandomIndexWriter iw, CountDownLatch startingGun, Random threadRandom, Document document, Field field)
+ public ThreadAnonymousInnerClassHelper(TestBagOfPositions outerInstance, int numTerms, int maxTermsPerDoc, ConcurrentQueue<string> postings, RandomIndexWriter iw, CountdownEvent startingGun, Random threadRandom, Document document, Field field)
{
this.OuterInstance = outerInstance;
this.NumTerms = numTerms;
@@ -178,7 +178,7 @@ namespace Lucene.Net.Index
{
try
{
- StartingGun.@await();
+ StartingGun.Wait();
while (!(Postings.Count == 0))
{
StringBuilder text = new StringBuilder();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Index/TestBagOfPostings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestBagOfPostings.cs b/src/Lucene.Net.Tests/core/Index/TestBagOfPostings.cs
index 38d6886..1650604 100644
--- a/src/Lucene.Net.Tests/core/Index/TestBagOfPostings.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestBagOfPostings.cs
@@ -1,8 +1,8 @@
-using Apache.NMS.Util;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Text;
+using System.Threading;
using Lucene.Net.Documents;
namespace Lucene.Net.Index
@@ -89,14 +89,14 @@ namespace Lucene.Net.Index
}
ThreadClass[] threads = new ThreadClass[threadCount];
- CountDownLatch startingGun = new CountDownLatch(1);
+ CountdownEvent startingGun = new CountdownEvent(1);
for (int threadID = 0; threadID < threadCount; threadID++)
{
threads[threadID] = new ThreadAnonymousInnerClassHelper(this, maxTermsPerDoc, postings, iw, startingGun);
threads[threadID].Start();
}
- startingGun.countDown();
+ startingGun.Signal();
foreach (ThreadClass t in threads)
{
t.Join();
@@ -135,9 +135,9 @@ namespace Lucene.Net.Index
private int MaxTermsPerDoc;
private ConcurrentQueue<string> Postings;
private RandomIndexWriter Iw;
- private CountDownLatch StartingGun;
+ private CountdownEvent StartingGun;
- public ThreadAnonymousInnerClassHelper(TestBagOfPostings outerInstance, int maxTermsPerDoc, ConcurrentQueue<string> postings, RandomIndexWriter iw, CountDownLatch startingGun)
+ public ThreadAnonymousInnerClassHelper(TestBagOfPostings outerInstance, int maxTermsPerDoc, ConcurrentQueue<string> postings, RandomIndexWriter iw, CountdownEvent startingGun)
{
this.OuterInstance = outerInstance;
this.MaxTermsPerDoc = maxTermsPerDoc;
@@ -153,7 +153,7 @@ namespace Lucene.Net.Index
Document document = new Document();
Field field = NewTextField("field", "", Field.Store.NO);
document.Add(field);
- StartingGun.@await();
+ StartingGun.Wait();
while (!(Postings.Count == 0))
{
StringBuilder text = new StringBuilder();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Index/TestBinaryDocValuesUpdates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestBinaryDocValuesUpdates.cs b/src/Lucene.Net.Tests/core/Index/TestBinaryDocValuesUpdates.cs
index 9f49a59..23324b5 100644
--- a/src/Lucene.Net.Tests/core/Index/TestBinaryDocValuesUpdates.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestBinaryDocValuesUpdates.cs
@@ -1,6 +1,6 @@
-using Apache.NMS.Util;
using System;
using System.Collections.Generic;
+ using System.Threading;
using Lucene.Net.Attributes;
using Lucene.Net.Documents;
@@ -1187,7 +1187,7 @@ namespace Lucene.Net.Index
writer.AddDocument(doc);
}
- CountDownLatch done = new CountDownLatch(numThreads);
+ CountdownEvent done = new CountdownEvent(numThreads);
AtomicInteger numUpdates = new AtomicInteger(AtLeast(100));
// same thread updates a field as well as reopens
@@ -1203,7 +1203,7 @@ namespace Lucene.Net.Index
{
t.Start();
}
- done.@await();
+ done.Wait();
writer.Dispose();
DirectoryReader reader = DirectoryReader.Open(dir);
@@ -1242,12 +1242,12 @@ namespace Lucene.Net.Index
private IndexWriter Writer;
private int NumDocs;
- private CountDownLatch Done;
+ private CountdownEvent Done;
private AtomicInteger NumUpdates;
private string f;
private string Cf;
- public ThreadAnonymousInnerClassHelper(TestBinaryDocValuesUpdates outerInstance, string str, IndexWriter writer, int numDocs, CountDownLatch done, AtomicInteger numUpdates, string f, string cf)
+ public ThreadAnonymousInnerClassHelper(TestBinaryDocValuesUpdates outerInstance, string str, IndexWriter writer, int numDocs, CountdownEvent done, AtomicInteger numUpdates, string f, string cf)
: base(str)
{
this.OuterInstance = outerInstance;
@@ -1355,7 +1355,7 @@ namespace Lucene.Net.Index
}
}
}
- Done.countDown();
+ Done.Signal();
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs b/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
index b137300..14397b9 100644
--- a/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
@@ -1,4 +1,3 @@
-using Apache.NMS.Util;
using System;
using System.Diagnostics;
using System.Threading;
@@ -301,7 +300,7 @@ namespace Lucene.Net.Index
int maxMergeCount = TestUtil.NextInt(Random(), 1, 5);
int maxMergeThreads = TestUtil.NextInt(Random(), 1, maxMergeCount);
- CountDownLatch enoughMergesWaiting = new CountDownLatch(maxMergeCount);
+ CountdownEvent enoughMergesWaiting = new CountdownEvent(maxMergeCount);
AtomicInteger runningMergeCount = new AtomicInteger(0);
AtomicBoolean failed = new AtomicBoolean();
@@ -323,7 +322,7 @@ namespace Lucene.Net.Index
IndexWriter w = new IndexWriter(dir, iwc);
Document doc = new Document();
doc.Add(NewField("field", "field", TextField.TYPE_NOT_STORED));
- while (enoughMergesWaiting.Remaining != 0 && !failed.Get())
+ while (enoughMergesWaiting.CurrentCount != 0 && !failed.Get())
{
for (int i = 0; i < 10; i++)
{
@@ -339,11 +338,11 @@ namespace Lucene.Net.Index
private readonly TestConcurrentMergeScheduler OuterInstance;
private int MaxMergeCount;
- private CountDownLatch EnoughMergesWaiting;
+ private CountdownEvent EnoughMergesWaiting;
private AtomicInteger RunningMergeCount;
private AtomicBoolean Failed;
- public ConcurrentMergeSchedulerAnonymousInnerClassHelper(TestConcurrentMergeScheduler outerInstance, int maxMergeCount, CountDownLatch enoughMergesWaiting, AtomicInteger runningMergeCount, AtomicBoolean failed)
+ public ConcurrentMergeSchedulerAnonymousInnerClassHelper(TestConcurrentMergeScheduler outerInstance, int maxMergeCount, CountdownEvent enoughMergesWaiting, AtomicInteger runningMergeCount, AtomicBoolean failed)
{
this.OuterInstance = outerInstance;
this.MaxMergeCount = maxMergeCount;
@@ -362,14 +361,14 @@ namespace Lucene.Net.Index
try
{
Assert.IsTrue(count <= MaxMergeCount, "count=" + count + " vs maxMergeCount=" + MaxMergeCount);
- EnoughMergesWaiting.countDown();
+ EnoughMergesWaiting.Signal();
// Stall this merge until we see exactly
// maxMergeCount merges waiting
while (true)
{
// wait for 10 milliseconds
- if (EnoughMergesWaiting.@await(new TimeSpan(0, 0, 0, 0, 10)) || Failed.Get())
+ if (EnoughMergesWaiting.Wait(new TimeSpan(0, 0, 0, 0, 10)) || Failed.Get())
{
break;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Index/TestDocValuesIndexing.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestDocValuesIndexing.cs b/src/Lucene.Net.Tests/core/Index/TestDocValuesIndexing.cs
index a09265a..0a50535 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDocValuesIndexing.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDocValuesIndexing.cs
@@ -1,5 +1,5 @@
-using Apache.NMS.Util;
using System;
+using System.Threading;
using Lucene.Net.Documents;
using Lucene.Net.Search;
@@ -510,7 +510,7 @@ namespace Lucene.Net.Index
Directory dir = NewDirectory();
IndexWriter w = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())));
- CountDownLatch startingGun = new CountDownLatch(1);
+ CountdownEvent startingGun = new CountdownEvent(1);
AtomicBoolean hitExc = new AtomicBoolean();
ThreadClass[] threads = new ThreadClass[3];
for (int i = 0; i < 3; i++)
@@ -535,7 +535,7 @@ namespace Lucene.Net.Index
threads[i].Start();
}
- startingGun.countDown();
+ startingGun.Signal();
foreach (ThreadClass t in threads)
{
@@ -551,11 +551,11 @@ namespace Lucene.Net.Index
private readonly TestDocValuesIndexing OuterInstance;
private IndexWriter w;
- private CountDownLatch StartingGun;
+ private CountdownEvent StartingGun;
private AtomicBoolean HitExc;
private Document Doc;
- public ThreadAnonymousInnerClassHelper(TestDocValuesIndexing outerInstance, IndexWriter w, CountDownLatch startingGun, AtomicBoolean hitExc, Document doc)
+ public ThreadAnonymousInnerClassHelper(TestDocValuesIndexing outerInstance, IndexWriter w, CountdownEvent startingGun, AtomicBoolean hitExc, Document doc)
{
this.OuterInstance = outerInstance;
this.w = w;
@@ -568,7 +568,7 @@ namespace Lucene.Net.Index
{
try
{
- StartingGun.@await();
+ StartingGun.Wait();
w.AddDocument(Doc);
}
catch (System.ArgumentException iae)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Index/TestDocValuesWithThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestDocValuesWithThreads.cs b/src/Lucene.Net.Tests/core/Index/TestDocValuesWithThreads.cs
index 4fc262e..5d29a06 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDocValuesWithThreads.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDocValuesWithThreads.cs
@@ -1,6 +1,6 @@
-using Apache.NMS.Util;
using System;
using System.Collections.Generic;
+using System.Threading;
using Lucene.Net.Documents;
using Lucene.Net.Search;
@@ -75,7 +75,7 @@ namespace Lucene.Net.Index
int numThreads = TestUtil.NextInt(Random(), 2, 5);
IList<ThreadClass> threads = new List<ThreadClass>();
- CountDownLatch startingGun = new CountDownLatch(1);
+ CountdownEvent startingGun = new CountdownEvent(1);
for (int t = 0; t < numThreads; t++)
{
Random threadRandom = new Random(Random().Next());
@@ -84,7 +84,7 @@ namespace Lucene.Net.Index
threads.Add(thread);
}
- startingGun.countDown();
+ startingGun.Signal();
foreach (ThreadClass thread in threads)
{
@@ -104,10 +104,10 @@ namespace Lucene.Net.Index
private IList<BytesRef> Sorted;
private int NumDocs;
private AtomicReader Ar;
- private CountDownLatch StartingGun;
+ private CountdownEvent StartingGun;
private Random ThreadRandom;
- public ThreadAnonymousInnerClassHelper(TestDocValuesWithThreads outerInstance, IList<long?> numbers, IList<BytesRef> binary, IList<BytesRef> sorted, int numDocs, AtomicReader ar, CountDownLatch startingGun, Random threadRandom)
+ public ThreadAnonymousInnerClassHelper(TestDocValuesWithThreads outerInstance, IList<long?> numbers, IList<BytesRef> binary, IList<BytesRef> sorted, int numDocs, AtomicReader ar, CountdownEvent startingGun, Random threadRandom)
{
this.OuterInstance = outerInstance;
this.Numbers = numbers;
@@ -128,7 +128,7 @@ namespace Lucene.Net.Index
//BinaryDocValues bdv = ar.GetBinaryDocValues("bytes");
BinaryDocValues bdv = FieldCache.DEFAULT.GetTerms(Ar, "bytes", false);
SortedDocValues sdv = FieldCache.DEFAULT.GetTermsIndex(Ar, "sorted");
- StartingGun.@await();
+ StartingGun.Wait();
int iters = AtLeast(1000);
BytesRef scratch = new BytesRef();
BytesRef scratch2 = new BytesRef();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterDeleteQueue.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterDeleteQueue.cs b/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterDeleteQueue.cs
index 3b017ce..dcd3212 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterDeleteQueue.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterDeleteQueue.cs
@@ -1,5 +1,4 @@
using System.Threading;
-using Apache.NMS.Util;
using Lucene.Net.Search;
using System;
using System.Collections;
@@ -219,7 +218,7 @@ namespace Lucene.Net.Index
ids[i] = Random().Next();
uniqueValues.Add(new Term("id", ids[i].ToString()));
}
- CountDownLatch latch = new CountDownLatch(1);
+ CountdownEvent latch = new CountdownEvent(1);
AtomicInteger index = new AtomicInteger(0);
int numThreads = 2 + Random().Next(5);
UpdateThread[] threads = new UpdateThread[numThreads];
@@ -228,7 +227,7 @@ namespace Lucene.Net.Index
threads[i] = new UpdateThread(queue, index, ids, latch);
threads[i].Start();
}
- latch.countDown();
+ latch.Signal();
for (int i = 0; i < threads.Length; i++)
{
threads[i].Join();
@@ -262,9 +261,9 @@ namespace Lucene.Net.Index
internal readonly int?[] Ids;
internal readonly DeleteSlice Slice;
internal readonly BufferedUpdates Deletes;
- internal readonly CountDownLatch Latch;
+ internal readonly CountdownEvent Latch;
- protected internal UpdateThread(DocumentsWriterDeleteQueue queue, AtomicInteger index, int?[] ids, CountDownLatch latch)
+ protected internal UpdateThread(DocumentsWriterDeleteQueue queue, AtomicInteger index, int?[] ids, CountdownEvent latch)
{
this.Queue = queue;
this.Index = index;
@@ -278,7 +277,7 @@ namespace Lucene.Net.Index
{
try
{
- Latch.@await();
+ Latch.Wait();
}
catch (ThreadInterruptedException e)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterStallControl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterStallControl.cs b/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterStallControl.cs
index 9c0b80d..5887c18 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterStallControl.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterStallControl.cs
@@ -1,4 +1,3 @@
-using Apache.NMS.Util;
using System;
using System.Collections.Generic;
using System.Threading;
@@ -150,7 +149,7 @@ namespace Lucene.Net.Index
{
if (checkPoint.Get())
{
- Assert.IsTrue(sync.UpdateJoin.@await(new TimeSpan(0, 0, 0, 10)), "timed out waiting for update threads - deadlock?");
+ Assert.IsTrue(sync.UpdateJoin.Wait(new TimeSpan(0, 0, 0, 10)), "timed out waiting for update threads - deadlock?");
if (exceptions.Count > 0)
{
foreach (Exception throwable in exceptions)
@@ -167,11 +166,11 @@ namespace Lucene.Net.Index
}
checkPoint.Set(false);
- sync.Waiter.countDown();
- sync.LeftCheckpoint.@await();
+ sync.Waiter.Signal();
+ sync.LeftCheckpoint.Wait();
}
Assert.IsFalse(checkPoint.Get());
- Assert.AreEqual(0, sync.Waiter.Remaining);
+ Assert.AreEqual(0, sync.Waiter.CurrentCount);
if (checkPointProbability >= (float)Random().NextDouble())
{
sync.Reset(numStallers + numReleasers, numStallers + numReleasers + numWaiters);
@@ -184,12 +183,12 @@ namespace Lucene.Net.Index
checkPoint.Set(true);
}
- Assert.IsTrue(sync.UpdateJoin.@await(new TimeSpan(0, 0, 0, 10)));
+ Assert.IsTrue(sync.UpdateJoin.Wait(new TimeSpan(0, 0, 0, 10)));
AssertState(numReleasers, numStallers, numWaiters, threads, ctrl);
checkPoint.Set(false);
stop.Set(true);
- sync.Waiter.countDown();
- sync.LeftCheckpoint.@await();
+ sync.Waiter.Signal();
+ sync.LeftCheckpoint.Wait();
for (int i = 0; i < threads.Length; i++)
{
@@ -266,11 +265,11 @@ namespace Lucene.Net.Index
{
try
{
- Assert.IsTrue(Sync.@await());
+ Assert.IsTrue(Sync.await());
}
catch (ThreadInterruptedException e)
{
- Console.WriteLine("[Waiter] got interrupted - wait count: " + Sync.Waiter.Remaining);
+ Console.WriteLine("[Waiter] got interrupted - wait count: " + Sync.Waiter.CurrentCount);
throw new ThreadInterruptedException("Thread Interrupted Exception", e);
}
}
@@ -318,17 +317,17 @@ namespace Lucene.Net.Index
}
if (CheckPoint.Get())
{
- Sync.UpdateJoin.countDown();
+ Sync.UpdateJoin.Signal();
try
{
- Assert.IsTrue(Sync.@await());
+ Assert.IsTrue(Sync.await());
}
catch (ThreadInterruptedException e)
{
- Console.WriteLine("[Updater] got interrupted - wait count: " + Sync.Waiter.Remaining);
+ Console.WriteLine("[Updater] got interrupted - wait count: " + Sync.Waiter.CurrentCount);
throw new ThreadInterruptedException("Thread Interrupted Exception", e);
}
- Sync.LeftCheckpoint.countDown();
+ Sync.LeftCheckpoint.Signal();
}
if (Random().NextBoolean())
{
@@ -342,7 +341,7 @@ namespace Lucene.Net.Index
Console.Write(e.StackTrace);
Exceptions.Add(e);
}
- Sync.UpdateJoin.countDown();
+ Sync.UpdateJoin.Signal();
}
}
@@ -434,9 +433,9 @@ namespace Lucene.Net.Index
public sealed class Synchronizer
{
- internal volatile CountDownLatch Waiter;
- internal volatile CountDownLatch UpdateJoin;
- internal volatile CountDownLatch LeftCheckpoint;
+ internal volatile CountdownEvent Waiter;
+ internal volatile CountdownEvent UpdateJoin;
+ internal volatile CountdownEvent LeftCheckpoint;
public Synchronizer(int numUpdater, int numThreads)
{
@@ -445,14 +444,14 @@ namespace Lucene.Net.Index
public void Reset(int numUpdaters, int numThreads)
{
- this.Waiter = new CountDownLatch(1);
- this.UpdateJoin = new CountDownLatch(numUpdaters);
- this.LeftCheckpoint = new CountDownLatch(numUpdaters);
+ this.Waiter = new CountdownEvent(1);
+ this.UpdateJoin = new CountdownEvent(numUpdaters);
+ this.LeftCheckpoint = new CountdownEvent(numUpdaters);
}
public bool @await()
{
- return Waiter.@await(new TimeSpan(0, 0, 0, 10));
+ return Waiter.Wait(new TimeSpan(0, 0, 0, 10));
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
index bf68f4f..cce436e 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
@@ -1,4 +1,3 @@
-using Apache.NMS.Util;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -336,17 +335,17 @@ namespace Lucene.Net.Index
RandomIndexWriter modifier = new RandomIndexWriter(Random(), dir);
int numThreads = AtLeast(2);
ThreadClass[] threads = new ThreadClass[numThreads];
- CountDownLatch latch = new CountDownLatch(1);
- CountDownLatch doneLatch = new CountDownLatch(numThreads);
+ CountdownEvent latch = new CountdownEvent(1);
+ CountdownEvent doneLatch = new CountdownEvent(numThreads);
for (int i = 0; i < numThreads; i++)
{
int offset = i;
threads[i] = new ThreadAnonymousInnerClassHelper(this, modifier, latch, doneLatch, offset);
threads[i].Start();
}
- latch.countDown();
+ latch.Signal();
//Wait for 1 millisecond
- while (!doneLatch.@await(new TimeSpan(0, 0, 0, 0, 1)))
+ while (!doneLatch.Wait(new TimeSpan(0, 0, 0, 0, 1)))
{
modifier.DeleteAll();
if (VERBOSE)
@@ -376,11 +375,11 @@ namespace Lucene.Net.Index
private readonly TestIndexWriterDelete OuterInstance;
private RandomIndexWriter Modifier;
- private CountDownLatch Latch;
- private CountDownLatch DoneLatch;
+ private CountdownEvent Latch;
+ private CountdownEvent DoneLatch;
private int Offset;
- public ThreadAnonymousInnerClassHelper(TestIndexWriterDelete outerInstance, RandomIndexWriter modifier, CountDownLatch latch, CountDownLatch doneLatch, int offset)
+ public ThreadAnonymousInnerClassHelper(TestIndexWriterDelete outerInstance, RandomIndexWriter modifier, CountdownEvent latch, CountdownEvent doneLatch, int offset)
{
this.OuterInstance = outerInstance;
this.Modifier = modifier;
@@ -395,7 +394,7 @@ namespace Lucene.Net.Index
int value = 100;
try
{
- Latch.@await();
+ Latch.Wait();
for (int j = 0; j < 1000; j++)
{
Document doc = new Document();
@@ -419,7 +418,7 @@ namespace Lucene.Net.Index
}
finally
{
- DoneLatch.countDown();
+ DoneLatch.Signal();
if (VERBOSE)
{
Console.WriteLine("\tThread[" + Offset + "]: done indexing");
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Index/TestIndexWriterNRTIsCurrent.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterNRTIsCurrent.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterNRTIsCurrent.cs
index 2e46d17..b93c2f3 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterNRTIsCurrent.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterNRTIsCurrent.cs
@@ -1,4 +1,3 @@
-using Apache.NMS.Util;
using System;
using System.Threading;
using Lucene.Net.Documents;
@@ -52,7 +51,7 @@ namespace Lucene.Net.Index
IndexWriter writer = new IndexWriter(dir, conf);
ReaderHolder holder = new ReaderHolder();
ReaderThread[] threads = new ReaderThread[AtLeast(3)];
- CountDownLatch latch = new CountDownLatch(1);
+ CountdownEvent latch = new CountdownEvent(1);
WriterThread writerThread = new WriterThread(holder, writer, AtLeast(500), Random(), latch);
for (int i = 0; i < threads.Length; i++)
{
@@ -89,10 +88,10 @@ namespace Lucene.Net.Index
internal readonly IndexWriter Writer;
internal readonly int NumOps;
internal bool Countdown = true;
- internal readonly CountDownLatch Latch;
+ internal readonly CountdownEvent Latch;
internal Exception Failed;
- internal WriterThread(ReaderHolder holder, IndexWriter writer, int numOps, Random random, CountDownLatch latch)
+ internal WriterThread(ReaderHolder holder, IndexWriter writer, int numOps, Random random, CountdownEvent latch)
: base()
{
this.Holder = holder;
@@ -135,7 +134,7 @@ namespace Lucene.Net.Index
if (Countdown)
{
Countdown = false;
- Latch.countDown();
+ Latch.Signal();
}
}
if (random.NextBoolean())
@@ -163,7 +162,7 @@ namespace Lucene.Net.Index
Holder.Reader = null;
if (Countdown)
{
- Latch.countDown();
+ Latch.Signal();
}
if (currentReader != null)
{
@@ -186,10 +185,10 @@ namespace Lucene.Net.Index
public sealed class ReaderThread : ThreadClass
{
internal readonly ReaderHolder Holder;
- internal readonly CountDownLatch Latch;
+ internal readonly CountdownEvent Latch;
internal Exception Failed;
- internal ReaderThread(ReaderHolder holder, CountDownLatch latch)
+ internal ReaderThread(ReaderHolder holder, CountdownEvent latch)
: base()
{
this.Holder = holder;
@@ -200,7 +199,7 @@ namespace Lucene.Net.Index
{
try
{
- Latch.@await();
+ Latch.Wait();
}
catch (ThreadInterruptedException e)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
index ba1d3d2..a1bbdcc 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
@@ -1,4 +1,3 @@
-using Apache.NMS.Util;
using System;
using System.Diagnostics;
using System.Threading;
@@ -545,13 +544,13 @@ namespace Lucene.Net.Index
public virtual void TestOpenTwoIndexWritersOnDifferentThreads()
{
Directory dir = NewDirectory();
- CountDownLatch oneIWConstructed = new CountDownLatch(1);
+ CountdownEvent oneIWConstructed = new CountdownEvent(1);
DelayedIndexAndCloseRunnable thread1 = new DelayedIndexAndCloseRunnable(dir, oneIWConstructed);
DelayedIndexAndCloseRunnable thread2 = new DelayedIndexAndCloseRunnable(dir, oneIWConstructed);
thread1.Start();
thread2.Start();
- oneIWConstructed.@await();
+ oneIWConstructed.Wait();
thread1.StartIndexing();
thread2.StartIndexing();
@@ -585,10 +584,10 @@ namespace Lucene.Net.Index
internal readonly Directory Dir;
internal bool Failed = false;
internal Exception Failure = null;
- internal readonly CountDownLatch StartIndexing_Renamed = new CountDownLatch(1);
- internal CountDownLatch IwConstructed;
+ internal readonly CountdownEvent StartIndexing_Renamed = new CountdownEvent(1);
+ internal CountdownEvent IwConstructed;
- public DelayedIndexAndCloseRunnable(Directory dir, CountDownLatch iwConstructed)
+ public DelayedIndexAndCloseRunnable(Directory dir, CountdownEvent iwConstructed)
{
this.Dir = dir;
this.IwConstructed = iwConstructed;
@@ -596,7 +595,7 @@ namespace Lucene.Net.Index
public virtual void StartIndexing()
{
- this.StartIndexing_Renamed.countDown();
+ this.StartIndexing_Renamed.Signal();
}
public override void Run()
@@ -607,8 +606,8 @@ namespace Lucene.Net.Index
Field field = NewTextField("field", "testData", Field.Store.YES);
doc.Add(field);
IndexWriter writer = new IndexWriter(Dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())));
- IwConstructed.countDown();
- StartIndexing_Renamed.@await();
+ IwConstructed.Signal();
+ StartIndexing_Renamed.Wait();
writer.AddDocument(doc);
writer.Dispose();
}
@@ -634,11 +633,11 @@ namespace Lucene.Net.Index
int threadCount = TestUtil.NextInt(Random(), 2, 6);
- AtomicReference<IndexWriter> writerRef = new AtomicReference<IndexWriter>();
MockAnalyzer analyzer = new MockAnalyzer(Random());
analyzer.MaxTokenLength = TestUtil.NextInt(Random(), 1, IndexWriter.MAX_TERM_LENGTH);
+ AtomicObject<IndexWriter> writerRef =
+ new AtomicObject<IndexWriter>(new IndexWriter(d, NewIndexWriterConfig(TEST_VERSION_CURRENT, analyzer)));
- writerRef.Value = new IndexWriter(d, NewIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
LineFileDocs docs = new LineFileDocs(Random());
ThreadClass[] threads = new ThreadClass[threadCount];
int iters = AtLeast(100);
@@ -666,14 +665,14 @@ namespace Lucene.Net.Index
private readonly TestIndexWriterWithThreads OuterInstance;
private BaseDirectoryWrapper d;
- private AtomicReference<IndexWriter> WriterRef;
+ private AtomicObject<IndexWriter> WriterRef;
private LineFileDocs Docs;
private int Iters;
private AtomicBoolean Failed;
private ReentrantLock RollbackLock;
private ReentrantLock CommitLock;
- public ThreadAnonymousInnerClassHelper(TestIndexWriterWithThreads outerInstance, BaseDirectoryWrapper d, AtomicReference<IndexWriter> writerRef, LineFileDocs docs, int iters, AtomicBoolean failed, ReentrantLock rollbackLock, ReentrantLock commitLock)
+ public ThreadAnonymousInnerClassHelper(TestIndexWriterWithThreads outerInstance, BaseDirectoryWrapper d, AtomicObject<IndexWriter> writerRef, LineFileDocs docs, int iters, AtomicBoolean failed, ReentrantLock rollbackLock, ReentrantLock commitLock)
{
this.OuterInstance = outerInstance;
this.d = d;
@@ -708,7 +707,8 @@ namespace Lucene.Net.Index
{
Console.WriteLine("TEST: " + Thread.CurrentThread.Name + ": rollback done; now open new writer");
}
- WriterRef.Value = new IndexWriter(d, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())));
+ WriterRef.Value =
+ new IndexWriter(d, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())));
}
finally
{
@@ -730,11 +730,11 @@ namespace Lucene.Net.Index
}
WriterRef.Value.Commit();
}
- catch (AlreadyClosedException ace)
+ catch (AlreadyClosedException)
{
// ok
}
- catch (System.NullReferenceException npe)
+ catch (NullReferenceException)
{
// ok
}
@@ -753,15 +753,15 @@ namespace Lucene.Net.Index
{
WriterRef.Value.AddDocument(Docs.NextDoc());
}
- catch (AlreadyClosedException ace)
+ catch (AlreadyClosedException)
{
// ok
}
- catch (System.NullReferenceException npe)
+ catch (System.NullReferenceException)
{
// ok
}
- catch (InvalidOperationException ae)
+ catch (InvalidOperationException)
{
// ok
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Index/TestMixedDocValuesUpdates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestMixedDocValuesUpdates.cs b/src/Lucene.Net.Tests/core/Index/TestMixedDocValuesUpdates.cs
index 8930728..5fd7339 100644
--- a/src/Lucene.Net.Tests/core/Index/TestMixedDocValuesUpdates.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestMixedDocValuesUpdates.cs
@@ -1,5 +1,5 @@
-using Apache.NMS.Util;
using System;
+using System.Threading;
using System.Collections.Generic;
using Lucene.Net.Documents;
@@ -263,7 +263,7 @@ namespace Lucene.Net.Index
writer.AddDocument(doc);
}
- CountDownLatch done = new CountDownLatch(numThreads);
+ CountdownEvent done = new CountdownEvent(numThreads);
AtomicInteger numUpdates = new AtomicInteger(AtLeast(100));
// same thread updates a field as well as reopens
@@ -279,7 +279,7 @@ namespace Lucene.Net.Index
{
t.Start();
}
- done.@await();
+ done.Wait();
writer.Dispose();
DirectoryReader reader = DirectoryReader.Open(dir);
@@ -323,12 +323,12 @@ namespace Lucene.Net.Index
private IndexWriter Writer;
private int NumDocs;
- private CountDownLatch Done;
+ private CountdownEvent Done;
private AtomicInteger NumUpdates;
private string f;
private string Cf;
- public ThreadAnonymousInnerClassHelper(TestMixedDocValuesUpdates outerInstance, string str, IndexWriter writer, int numDocs, CountDownLatch done, AtomicInteger numUpdates, string f, string cf)
+ public ThreadAnonymousInnerClassHelper(TestMixedDocValuesUpdates outerInstance, string str, IndexWriter writer, int numDocs, CountdownEvent done, AtomicInteger numUpdates, string f, string cf)
: base(str)
{
this.OuterInstance = outerInstance;
@@ -438,7 +438,7 @@ namespace Lucene.Net.Index
}
}
}
- Done.countDown();
+ Done.Signal();
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Index/TestNumericDocValuesUpdates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestNumericDocValuesUpdates.cs b/src/Lucene.Net.Tests/core/Index/TestNumericDocValuesUpdates.cs
index bf9d902..b9d592d 100644
--- a/src/Lucene.Net.Tests/core/Index/TestNumericDocValuesUpdates.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestNumericDocValuesUpdates.cs
@@ -1,6 +1,6 @@
-using Apache.NMS.Util;
using System;
using System.Collections.Generic;
+using System.Threading;
using Lucene.Net.Documents;
namespace Lucene.Net.Index
@@ -1140,7 +1140,7 @@ namespace Lucene.Net.Index
writer.AddDocument(doc);
}
- CountDownLatch done = new CountDownLatch(numThreads);
+ CountdownEvent done = new CountdownEvent(numThreads);
AtomicInteger numUpdates = new AtomicInteger(AtLeast(100));
// same thread updates a field as well as reopens
@@ -1156,7 +1156,7 @@ namespace Lucene.Net.Index
{
t.Start();
}
- done.@await();
+ done.Wait();
writer.Dispose();
DirectoryReader reader = DirectoryReader.Open(dir);
@@ -1194,12 +1194,12 @@ namespace Lucene.Net.Index
private IndexWriter Writer;
private int NumDocs;
- private CountDownLatch Done;
+ private CountdownEvent Done;
private AtomicInteger NumUpdates;
private string f;
private string Cf;
- public ThreadAnonymousInnerClassHelper(TestNumericDocValuesUpdates outerInstance, string str, IndexWriter writer, int numDocs, CountDownLatch done, AtomicInteger numUpdates, string f, string cf)
+ public ThreadAnonymousInnerClassHelper(TestNumericDocValuesUpdates outerInstance, string str, IndexWriter writer, int numDocs, CountdownEvent done, AtomicInteger numUpdates, string f, string cf)
: base(str)
{
this.OuterInstance = outerInstance;
@@ -1307,7 +1307,7 @@ namespace Lucene.Net.Index
}
}
}
- Done.countDown();
+ Done.Signal();
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Search/TestAutomatonQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestAutomatonQuery.cs b/src/Lucene.Net.Tests/core/Search/TestAutomatonQuery.cs
index edbbded..87db2cd 100644
--- a/src/Lucene.Net.Tests/core/Search/TestAutomatonQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestAutomatonQuery.cs
@@ -1,7 +1,7 @@
-using Apache.NMS.Util;
using Lucene.Net.Documents;
using Lucene.Net.Support;
using System;
+using System.Threading;
namespace Lucene.Net.Search
{
@@ -230,7 +230,7 @@ namespace Lucene.Net.Search
{
queries[i] = new AutomatonQuery(new Term("bogus", "bogus"), AutomatonTestUtil.RandomAutomaton(Random()));
}
- CountDownLatch startingGun = new CountDownLatch(1);
+ CountdownEvent startingGun = new CountdownEvent(1);
int numThreads = TestUtil.NextInt(Random(), 2, 5);
ThreadClass[] threads = new ThreadClass[numThreads];
for (int threadID = 0; threadID < numThreads; threadID++)
@@ -239,7 +239,7 @@ namespace Lucene.Net.Search
threads[threadID] = thread;
thread.Start();
}
- startingGun.countDown();
+ startingGun.Signal();
foreach (ThreadClass thread in threads)
{
thread.Join();
@@ -251,9 +251,9 @@ namespace Lucene.Net.Search
private readonly TestAutomatonQuery OuterInstance;
private AutomatonQuery[] Queries;
- private CountDownLatch StartingGun;
+ private CountdownEvent StartingGun;
- public ThreadAnonymousInnerClassHelper(TestAutomatonQuery outerInstance, AutomatonQuery[] queries, CountDownLatch startingGun)
+ public ThreadAnonymousInnerClassHelper(TestAutomatonQuery outerInstance, AutomatonQuery[] queries, CountdownEvent startingGun)
{
this.OuterInstance = outerInstance;
this.Queries = queries;
@@ -262,7 +262,7 @@ namespace Lucene.Net.Search
public override void Run()
{
- StartingGun.@await();
+ StartingGun.Wait();
for (int i = 0; i < Queries.Length; i++)
{
Queries[i].GetHashCode();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Search/TestLiveFieldValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestLiveFieldValues.cs b/src/Lucene.Net.Tests/core/Search/TestLiveFieldValues.cs
index 6c3cc7d..4857fe1 100644
--- a/src/Lucene.Net.Tests/core/Search/TestLiveFieldValues.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestLiveFieldValues.cs
@@ -1,9 +1,9 @@
-using Apache.NMS.Util;
using Lucene.Net.Documents;
using Lucene.Net.Support;
using System;
using System.Collections.Generic;
using System.Globalization;
+using System.Threading;
namespace Lucene.Net.Search
{
@@ -62,7 +62,7 @@ namespace Lucene.Net.Search
Console.WriteLine(numThreads + " threads");
}
- CountDownLatch startingGun = new CountDownLatch(1);
+ CountdownEvent startingGun = new CountdownEvent(1);
IList<ThreadClass> threads = new List<ThreadClass>();
int iters = AtLeast(1000);
@@ -81,7 +81,7 @@ namespace Lucene.Net.Search
thread.Start();
}
- startingGun.countDown();
+ startingGun.Signal();
foreach (ThreadClass thread in threads)
{
@@ -134,7 +134,7 @@ namespace Lucene.Net.Search
private SearcherManager Mgr;
private int? Missing;
private LiveFieldValues<IndexSearcher, int?> Rt;
- private CountDownLatch StartingGun;
+ private CountdownEvent StartingGun;
private int Iters;
private int IdCount;
private double ReopenChance;
@@ -144,7 +144,7 @@ namespace Lucene.Net.Search
private int ThreadID;
private Random ThreadRandom;
- public ThreadAnonymousInnerClassHelper(IndexWriter w, SearcherManager mgr, int? missing, LiveFieldValues<IndexSearcher, int?> rt, CountDownLatch startingGun, int iters, int idCount, double reopenChance, double deleteChance, double addChance, int t, int threadID, Random threadRandom)
+ public ThreadAnonymousInnerClassHelper(IndexWriter w, SearcherManager mgr, int? missing, LiveFieldValues<IndexSearcher, int?> rt, CountdownEvent startingGun, int iters, int idCount, double reopenChance, double deleteChance, double addChance, int t, int threadID, Random threadRandom)
{
this.w = w;
this.Mgr = mgr;
@@ -168,7 +168,7 @@ namespace Lucene.Net.Search
IDictionary<string, int?> values = new Dictionary<string, int?>();
IList<string> allIDs = new SynchronizedCollection<string>();
- StartingGun.@await();
+ StartingGun.Wait();
for (int iter = 0; iter < Iters; iter++)
{
// Add/update a document
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Search/TestSameScoresWithThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestSameScoresWithThreads.cs b/src/Lucene.Net.Tests/core/Search/TestSameScoresWithThreads.cs
index 4541437..616ca1d 100644
--- a/src/Lucene.Net.Tests/core/Search/TestSameScoresWithThreads.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestSameScoresWithThreads.cs
@@ -1,6 +1,6 @@
-using Apache.NMS.Util;
using System;
using System.Collections.Generic;
+using System.Threading;
namespace Lucene.Net.Search
{
@@ -89,7 +89,7 @@ namespace Lucene.Net.Search
if (answers.Count > 0)
{
- CountDownLatch startingGun = new CountDownLatch(1);
+ CountdownEvent startingGun = new CountdownEvent(1);
int numThreads = TestUtil.NextInt(Random(), 2, 5);
ThreadClass[] threads = new ThreadClass[numThreads];
for (int threadID = 0; threadID < numThreads; threadID++)
@@ -98,7 +98,7 @@ namespace Lucene.Net.Search
threads[threadID] = thread;
thread.Start();
}
- startingGun.countDown();
+ startingGun.Signal();
foreach (ThreadClass thread in threads)
{
thread.Join();
@@ -114,9 +114,9 @@ namespace Lucene.Net.Search
private IndexSearcher s;
private IDictionary<BytesRef, TopDocs> Answers;
- private CountDownLatch StartingGun;
+ private CountdownEvent StartingGun;
- public ThreadAnonymousInnerClassHelper(TestSameScoresWithThreads outerInstance, IndexSearcher s, IDictionary<BytesRef, TopDocs> answers, CountDownLatch startingGun)
+ public ThreadAnonymousInnerClassHelper(TestSameScoresWithThreads outerInstance, IndexSearcher s, IDictionary<BytesRef, TopDocs> answers, CountdownEvent startingGun)
{
this.OuterInstance = outerInstance;
this.s = s;
@@ -128,7 +128,7 @@ namespace Lucene.Net.Search
{
try
{
- StartingGun.@await();
+ StartingGun.Wait();
for (int i = 0; i < 20; i++)
{
IList<KeyValuePair<BytesRef, TopDocs>> shuffled = new List<KeyValuePair<BytesRef, TopDocs>>(Answers.EntrySet());
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs b/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
index 5b0122d..aedc8e5 100644
--- a/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
@@ -1,4 +1,3 @@
-using Apache.NMS.Util;
using System;
using System.Collections.Generic;
using System.Threading;
@@ -265,8 +264,8 @@ namespace Lucene.Net.Search
IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMergeScheduler(new ConcurrentMergeScheduler()));
writer.AddDocument(new Document());
writer.Commit();
- CountDownLatch awaitEnterWarm = new CountDownLatch(1);
- CountDownLatch awaitClose = new CountDownLatch(1);
+ CountdownEvent awaitEnterWarm = new CountdownEvent(1);
+ CountdownEvent awaitClose = new CountdownEvent(1);
AtomicBoolean triedReopen = new AtomicBoolean(false);
TaskScheduler es = Random().NextBoolean() ? null : Executors.newCachedThreadPool(new NamedThreadFactory("testIntermediateClose"));
SearcherFactory factory = new SearcherFactoryAnonymousInnerClassHelper2(this, awaitEnterWarm, awaitClose, triedReopen, es);
@@ -294,13 +293,13 @@ namespace Lucene.Net.Search
{
Console.WriteLine("THREAD started");
}
- awaitEnterWarm.@await();
+ awaitEnterWarmWait();
if (VERBOSE)
{
Console.WriteLine("NOW call close");
}
searcherManager.Dispose();
- awaitClose.countDown();
+ awaitClose.Signal();
thread.Join();
try
{
@@ -327,12 +326,12 @@ namespace Lucene.Net.Search
{
private readonly TestSearcherManager OuterInstance;
- private CountDownLatch AwaitEnterWarm;
- private CountDownLatch AwaitClose;
+ private CountdownEvent AwaitEnterWarm;
+ private CountdownEvent AwaitClose;
private AtomicBoolean TriedReopen;
private TaskScheduler Es;
- public SearcherFactoryAnonymousInnerClassHelper2(TestSearcherManager outerInstance, CountDownLatch awaitEnterWarm, CountDownLatch awaitClose, AtomicBoolean triedReopen, TaskScheduler es)
+ public SearcherFactoryAnonymousInnerClassHelper2(TestSearcherManager outerInstance, CountdownEvent awaitEnterWarm, CountdownEvent awaitClose, AtomicBoolean triedReopen, TaskScheduler es)
{
this.OuterInstance = outerInstance;
this.AwaitEnterWarm = awaitEnterWarm;
@@ -347,8 +346,8 @@ namespace Lucene.Net.Search
{
if (TriedReopen.Get())
{
- AwaitEnterWarm.countDown();
- AwaitClose.@await();
+ AwaitEnterWarm.Signal();
+ AwaitClose.Wait();
}
}
catch (ThreadInterruptedException e)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/69592a68/src/Lucene.Net.Tests/packages.config
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/packages.config b/src/Lucene.Net.Tests/packages.config
index ffa0c4a..7a698ab 100644
--- a/src/Lucene.Net.Tests/packages.config
+++ b/src/Lucene.Net.Tests/packages.config
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Apache.NMS" version="1.6.0.3083" targetFramework="net40" />
<package id="NUnit" version="2.6.3" targetFramework="net40" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net40" />
</packages>
\ No newline at end of file