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:35 UTC
[1/4] lucenenet git commit: Revert "Removing Apache.NMS dependency."
Repository: lucenenet
Updated Branches:
refs/heads/master 72ec63abf -> c78bc2e5d
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 6e92ffc..ba1d3d2 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterWithThreads.cs
@@ -1,3 +1,4 @@
+using Apache.NMS.Util;
using System;
using System.Diagnostics;
using System.Threading;
@@ -544,13 +545,13 @@ namespace Lucene.Net.Index
public virtual void TestOpenTwoIndexWritersOnDifferentThreads()
{
Directory dir = NewDirectory();
- CountdownEvent oneIWConstructed = new CountdownEvent(1);
+ CountDownLatch oneIWConstructed = new CountDownLatch(1);
DelayedIndexAndCloseRunnable thread1 = new DelayedIndexAndCloseRunnable(dir, oneIWConstructed);
DelayedIndexAndCloseRunnable thread2 = new DelayedIndexAndCloseRunnable(dir, oneIWConstructed);
thread1.Start();
thread2.Start();
- oneIWConstructed.Wait();
+ oneIWConstructed.@await();
thread1.StartIndexing();
thread2.StartIndexing();
@@ -584,10 +585,10 @@ namespace Lucene.Net.Index
internal readonly Directory Dir;
internal bool Failed = false;
internal Exception Failure = null;
- internal readonly CountdownEvent StartIndexing_Renamed = new CountdownEvent(1);
- internal CountdownEvent IwConstructed;
+ internal readonly CountDownLatch StartIndexing_Renamed = new CountDownLatch(1);
+ internal CountDownLatch IwConstructed;
- public DelayedIndexAndCloseRunnable(Directory dir, CountdownEvent iwConstructed)
+ public DelayedIndexAndCloseRunnable(Directory dir, CountDownLatch iwConstructed)
{
this.Dir = dir;
this.IwConstructed = iwConstructed;
@@ -595,7 +596,7 @@ namespace Lucene.Net.Index
public virtual void StartIndexing()
{
- this.StartIndexing_Renamed.Signal();
+ this.StartIndexing_Renamed.countDown();
}
public override void Run()
@@ -606,8 +607,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.Signal();
- StartIndexing_Renamed.Wait();
+ IwConstructed.countDown();
+ StartIndexing_Renamed.@await();
writer.AddDocument(doc);
writer.Dispose();
}
@@ -633,10 +634,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);
- IndexWriter writerRef = 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);
@@ -655,7 +657,7 @@ namespace Lucene.Net.Index
}
Assert.IsTrue(!failed.Get());
- writerRef.Dispose();
+ writerRef.Value.Dispose();
d.Dispose();
}
@@ -664,14 +666,14 @@ namespace Lucene.Net.Index
private readonly TestIndexWriterWithThreads OuterInstance;
private BaseDirectoryWrapper d;
- private IndexWriter WriterRef;
+ private AtomicReference<IndexWriter> WriterRef;
private LineFileDocs Docs;
private int Iters;
private AtomicBoolean Failed;
private ReentrantLock RollbackLock;
private ReentrantLock CommitLock;
- public ThreadAnonymousInnerClassHelper(TestIndexWriterWithThreads outerInstance, BaseDirectoryWrapper d, IndexWriter writerRef, LineFileDocs docs, int iters, AtomicBoolean failed, ReentrantLock rollbackLock, ReentrantLock commitLock)
+ public ThreadAnonymousInnerClassHelper(TestIndexWriterWithThreads outerInstance, BaseDirectoryWrapper d, AtomicReference<IndexWriter> writerRef, LineFileDocs docs, int iters, AtomicBoolean failed, ReentrantLock rollbackLock, ReentrantLock commitLock)
{
this.OuterInstance = outerInstance;
this.d = d;
@@ -701,12 +703,12 @@ namespace Lucene.Net.Index
}
try
{
- WriterRef.Rollback();
+ WriterRef.Value.Rollback();
if (VERBOSE)
{
Console.WriteLine("TEST: " + Thread.CurrentThread.Name + ": rollback done; now open new writer");
}
- Interlocked.Exchange(ref WriterRef, new IndexWriter(d, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))));
+ WriterRef.Value = new IndexWriter(d, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())));
}
finally
{
@@ -724,15 +726,15 @@ namespace Lucene.Net.Index
{
if (Random().NextBoolean())
{
- WriterRef.PrepareCommit();
+ WriterRef.Value.PrepareCommit();
}
- WriterRef.Commit();
+ WriterRef.Value.Commit();
}
- catch (AlreadyClosedException)
+ catch (AlreadyClosedException ace)
{
// ok
}
- catch (NullReferenceException)
+ catch (System.NullReferenceException npe)
{
// ok
}
@@ -749,17 +751,17 @@ namespace Lucene.Net.Index
}
try
{
- WriterRef.AddDocument(Docs.NextDoc());
+ WriterRef.Value.AddDocument(Docs.NextDoc());
}
- catch (AlreadyClosedException)
+ catch (AlreadyClosedException ace)
{
// ok
}
- catch (System.NullReferenceException)
+ catch (System.NullReferenceException npe)
{
// ok
}
- catch (InvalidOperationException)
+ catch (InvalidOperationException ae)
{
// ok
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 5fd7339..8930728 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);
}
- CountdownEvent done = new CountdownEvent(numThreads);
+ CountDownLatch done = new CountDownLatch(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.Wait();
+ done.@await();
writer.Dispose();
DirectoryReader reader = DirectoryReader.Open(dir);
@@ -323,12 +323,12 @@ namespace Lucene.Net.Index
private IndexWriter Writer;
private int NumDocs;
- private CountdownEvent Done;
+ private CountDownLatch Done;
private AtomicInteger NumUpdates;
private string f;
private string Cf;
- public ThreadAnonymousInnerClassHelper(TestMixedDocValuesUpdates outerInstance, string str, IndexWriter writer, int numDocs, CountdownEvent done, AtomicInteger numUpdates, string f, string cf)
+ public ThreadAnonymousInnerClassHelper(TestMixedDocValuesUpdates outerInstance, string str, IndexWriter writer, int numDocs, CountDownLatch done, AtomicInteger numUpdates, string f, string cf)
: base(str)
{
this.OuterInstance = outerInstance;
@@ -438,7 +438,7 @@ namespace Lucene.Net.Index
}
}
}
- Done.Signal();
+ Done.countDown();
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 b9d592d..bf9d902 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);
}
- CountdownEvent done = new CountdownEvent(numThreads);
+ CountDownLatch done = new CountDownLatch(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.Wait();
+ done.@await();
writer.Dispose();
DirectoryReader reader = DirectoryReader.Open(dir);
@@ -1194,12 +1194,12 @@ namespace Lucene.Net.Index
private IndexWriter Writer;
private int NumDocs;
- private CountdownEvent Done;
+ private CountDownLatch Done;
private AtomicInteger NumUpdates;
private string f;
private string Cf;
- public ThreadAnonymousInnerClassHelper(TestNumericDocValuesUpdates outerInstance, string str, IndexWriter writer, int numDocs, CountdownEvent done, AtomicInteger numUpdates, string f, string cf)
+ public ThreadAnonymousInnerClassHelper(TestNumericDocValuesUpdates outerInstance, string str, IndexWriter writer, int numDocs, CountDownLatch done, AtomicInteger numUpdates, string f, string cf)
: base(str)
{
this.OuterInstance = outerInstance;
@@ -1307,7 +1307,7 @@ namespace Lucene.Net.Index
}
}
}
- Done.Signal();
+ Done.countDown();
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 87db2cd..edbbded 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()));
}
- CountdownEvent startingGun = new CountdownEvent(1);
+ CountDownLatch startingGun = new CountDownLatch(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.Signal();
+ startingGun.countDown();
foreach (ThreadClass thread in threads)
{
thread.Join();
@@ -251,9 +251,9 @@ namespace Lucene.Net.Search
private readonly TestAutomatonQuery OuterInstance;
private AutomatonQuery[] Queries;
- private CountdownEvent StartingGun;
+ private CountDownLatch StartingGun;
- public ThreadAnonymousInnerClassHelper(TestAutomatonQuery outerInstance, AutomatonQuery[] queries, CountdownEvent startingGun)
+ public ThreadAnonymousInnerClassHelper(TestAutomatonQuery outerInstance, AutomatonQuery[] queries, CountDownLatch startingGun)
{
this.OuterInstance = outerInstance;
this.Queries = queries;
@@ -262,7 +262,7 @@ namespace Lucene.Net.Search
public override void Run()
{
- StartingGun.Wait();
+ StartingGun.@await();
for (int i = 0; i < Queries.Length; i++)
{
Queries[i].GetHashCode();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 4857fe1..6c3cc7d 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");
}
- CountdownEvent startingGun = new CountdownEvent(1);
+ CountDownLatch startingGun = new CountDownLatch(1);
IList<ThreadClass> threads = new List<ThreadClass>();
int iters = AtLeast(1000);
@@ -81,7 +81,7 @@ namespace Lucene.Net.Search
thread.Start();
}
- startingGun.Signal();
+ startingGun.countDown();
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 CountdownEvent StartingGun;
+ private CountDownLatch 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, CountdownEvent 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, CountDownLatch 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.Wait();
+ StartingGun.@await();
for (int iter = 0; iter < Iters; iter++)
{
// Add/update a document
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 616ca1d..4541437 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)
{
- CountdownEvent startingGun = new CountdownEvent(1);
+ CountDownLatch startingGun = new CountDownLatch(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.Signal();
+ startingGun.countDown();
foreach (ThreadClass thread in threads)
{
thread.Join();
@@ -114,9 +114,9 @@ namespace Lucene.Net.Search
private IndexSearcher s;
private IDictionary<BytesRef, TopDocs> Answers;
- private CountdownEvent StartingGun;
+ private CountDownLatch StartingGun;
- public ThreadAnonymousInnerClassHelper(TestSameScoresWithThreads outerInstance, IndexSearcher s, IDictionary<BytesRef, TopDocs> answers, CountdownEvent startingGun)
+ public ThreadAnonymousInnerClassHelper(TestSameScoresWithThreads outerInstance, IndexSearcher s, IDictionary<BytesRef, TopDocs> answers, CountDownLatch startingGun)
{
this.OuterInstance = outerInstance;
this.s = s;
@@ -128,7 +128,7 @@ namespace Lucene.Net.Search
{
try
{
- StartingGun.Wait();
+ StartingGun.@await();
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/a5e8c8b6/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 aedc8e5..5b0122d 100644
--- a/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
@@ -1,3 +1,4 @@
+using Apache.NMS.Util;
using System;
using System.Collections.Generic;
using System.Threading;
@@ -264,8 +265,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();
- CountdownEvent awaitEnterWarm = new CountdownEvent(1);
- CountdownEvent awaitClose = new CountdownEvent(1);
+ CountDownLatch awaitEnterWarm = new CountDownLatch(1);
+ CountDownLatch awaitClose = new CountDownLatch(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);
@@ -293,13 +294,13 @@ namespace Lucene.Net.Search
{
Console.WriteLine("THREAD started");
}
- awaitEnterWarmWait();
+ awaitEnterWarm.@await();
if (VERBOSE)
{
Console.WriteLine("NOW call close");
}
searcherManager.Dispose();
- awaitClose.Signal();
+ awaitClose.countDown();
thread.Join();
try
{
@@ -326,12 +327,12 @@ namespace Lucene.Net.Search
{
private readonly TestSearcherManager OuterInstance;
- private CountdownEvent AwaitEnterWarm;
- private CountdownEvent AwaitClose;
+ private CountDownLatch AwaitEnterWarm;
+ private CountDownLatch AwaitClose;
private AtomicBoolean TriedReopen;
private TaskScheduler Es;
- public SearcherFactoryAnonymousInnerClassHelper2(TestSearcherManager outerInstance, CountdownEvent awaitEnterWarm, CountdownEvent awaitClose, AtomicBoolean triedReopen, TaskScheduler es)
+ public SearcherFactoryAnonymousInnerClassHelper2(TestSearcherManager outerInstance, CountDownLatch awaitEnterWarm, CountDownLatch awaitClose, AtomicBoolean triedReopen, TaskScheduler es)
{
this.OuterInstance = outerInstance;
this.AwaitEnterWarm = awaitEnterWarm;
@@ -346,8 +347,8 @@ namespace Lucene.Net.Search
{
if (TriedReopen.Get())
{
- AwaitEnterWarm.Signal();
- AwaitClose.Wait();
+ AwaitEnterWarm.countDown();
+ AwaitClose.@await();
}
}
catch (ThreadInterruptedException e)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/src/Lucene.Net.Tests/core/Util/TestNamedSPILoader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestNamedSPILoader.cs b/src/Lucene.Net.Tests/core/Util/TestNamedSPILoader.cs
index 0dcec35..5d42841 100644
--- a/src/Lucene.Net.Tests/core/Util/TestNamedSPILoader.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestNamedSPILoader.cs
@@ -1,8 +1,10 @@
-using System;
using NUnit.Framework;
+using System.Collections.Generic;
namespace Lucene.Net.Util
{
+ using Codec = Lucene.Net.Codecs.Codec;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,77 +22,37 @@ namespace Lucene.Net.Util
* limitations under the License.
*/
+ // TODO: maybe we should test this with mocks, but its easy
+ // enough to test the basics via Codec
[TestFixture]
public class TestNamedSPILoader : LuceneTestCase
{
[Test]
- public void Lookup_ExistingService_ReturnServiceByName()
- {
- // Arrange
- var loader = CreateNamedSPILoaderForCodecClass();
-
- // Act
- var codec = loader.Lookup("CustomCodec1");
-
- // Assert
- Assert.IsInstanceOf<CustomCodec1>(codec);
- Assert.AreEqual("CustomCodec1", codec.Name);
- }
-
- [Test]
- public void Lookup_NonexistingService_ThrowsException()
+ public virtual void TestLookup()
{
- // Arrange
- var loader = CreateNamedSPILoaderForCodecClass();
-
- // Act
- var actualException = Assert.Throws<ArgumentException>(() => loader.Lookup("NonexistingCodecName"));
-
- // Assert
- const string expectedMessage = "An SPI class of type CustomCodec with name 'NonexistingCodecName' does not exist. "
- + "You need to reference the corresponding assembly that contains the class. "
- + "The current NamedSPILoader supports the following names: CustomCodec1, CustomCodec2";
- Assert.AreEqual(expectedMessage, actualException.Message);
+ Codec codec = Codec.ForName("Lucene46");
+ Assert.AreEqual("Lucene46", codec.Name);
}
+ // we want an exception if its not found.
[Test]
- public void AvailableServices_LoaderWithServices_ReturnsListOfNamesOfRegisteredServices()
+ public virtual void TestBogusLookup()
{
- // Arrange
- var expectedServices = new [] { "CustomCodec1", "CustomCodec2" };
- var loader = CreateNamedSPILoaderForCodecClass();
-
- // Act
- var actualServices = loader.AvailableServices();
-
- // Assert
- Assert.IsNotNull(actualServices);
- CollectionAssert.IsNotEmpty(actualServices);
- CollectionAssert.AreEqual(expectedServices, actualServices);
- }
-
- private static NamedSPILoader<CustomCodec> CreateNamedSPILoaderForCodecClass()
- {
- return new NamedSPILoader<CustomCodec>(typeof(CustomCodec));
- }
-
- private abstract class CustomCodec : NamedSPILoader<CustomCodec>.NamedSPI
- {
- public string Name
+ try
+ {
+ Codec.ForName("dskfdskfsdfksdfdsf");
+ Assert.Fail();
+ }
+ catch (System.ArgumentException expected)
{
- get
- {
- return this.GetType().Name;
- }
}
}
- private class CustomCodec1 : CustomCodec
- {
- }
-
- private class CustomCodec2 : CustomCodec
+ [Test]
+ public virtual void TestAvailableServices()
{
+ ISet<string> codecs = Codec.AvailableCodecs();
+ Assert.IsTrue(codecs.Contains("Lucene46"));
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/src/Lucene.Net.Tests/packages.config
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/packages.config b/src/Lucene.Net.Tests/packages.config
index 967502d..ffa0c4a 100644
--- a/src/Lucene.Net.Tests/packages.config
+++ b/src/Lucene.Net.Tests/packages.config
@@ -1,4 +1,6 @@
<?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
[3/4] lucenenet git commit: Removing Apache.NMS dependency.
Posted by sy...@apache.org.
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
[4/4] lucenenet git commit: Close #168
Posted by sy...@apache.org.
Close #168
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/c78bc2e5
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/c78bc2e5
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/c78bc2e5
Branch: refs/heads/master
Commit: c78bc2e5dd870319b763008e2312134605bc8296
Parents: 69592a6
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Sun Apr 24 01:26:31 2016 +0300
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Sun Apr 24 01:26:31 2016 +0300
----------------------------------------------------------------------
----------------------------------------------------------------------
[2/4] lucenenet git commit: Revert "Removing Apache.NMS dependency."
Posted by sy...@apache.org.
Revert "Removing Apache.NMS dependency."
This reverts commit 6c62d649dc3699e1b0f5098d902c1a6b43e31b76.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/a5e8c8b6
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/a5e8c8b6
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/a5e8c8b6
Branch: refs/heads/master
Commit: a5e8c8b600f99d75ed880e37f3baeae9b58ccfd7
Parents: 72ec63a
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Sun Apr 24 01:25:37 2016 +0300
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Sun Apr 24 01:25:37 2016 +0300
----------------------------------------------------------------------
.gitignore | 1 -
Lucene.Net.sln | 127 ++++++++++++++++++-
src/Lucene.Net.Core/Codecs/Codec.cs | 4 +-
src/Lucene.Net.Core/Lucene.Net.csproj | 6 +-
src/Lucene.Net.Core/Util/NamedSPILoader.cs | 6 +-
src/Lucene.Net.Core/packages.config | 1 +
.../Analysis/BaseTokenStreamTestCase.cs | 11 +-
.../Index/BaseDocValuesFormatTestCase.cs | 22 ++--
.../Index/BaseStoredFieldsFormatTestCase.cs | 15 ++-
.../Index/BaseTermVectorsFormatTestCase.cs | 11 +-
.../Lucene.Net.TestFramework.csproj | 6 +
src/Lucene.Net.TestFramework/packages.config | 2 +
.../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 | 8 +-
src/Lucene.Net.Tests/core/Codecs/TestCodec.cs | 48 -------
.../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 | 46 +++----
.../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 +--
.../core/Util/TestNamedSPILoader.cs | 78 +++---------
src/Lucene.Net.Tests/packages.config | 2 +
40 files changed, 361 insertions(+), 293 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 1179779..27e2d1b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,4 +33,3 @@ obj/
doc/
src/demo/
packages/
-TestResults/
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/Lucene.Net.sln
----------------------------------------------------------------------
diff --git a/Lucene.Net.sln b/Lucene.Net.sln
index 8c5405e..baeedad 100644
--- a/Lucene.Net.sln
+++ b/Lucene.Net.sln
@@ -49,81 +49,200 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|x86.ActiveCfg = Debug|x86
+ {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Debug|x86.Build.0 = Debug|x86
+ {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Any CPU.ActiveCfg = Release|x86
+ {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|Mixed Platforms.Build.0 = Release|x86
+ {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|x86.ActiveCfg = Release|x86
+ {5D4AD9BE-1FFB-41AB-9943-25737971BF57}.Release|x86.Build.0 = Release|x86
{DE63DB10-975F-460D-AF85-572C17A91284}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE63DB10-975F-460D-AF85-572C17A91284}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DE63DB10-975F-460D-AF85-572C17A91284}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {DE63DB10-975F-460D-AF85-572C17A91284}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {DE63DB10-975F-460D-AF85-572C17A91284}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {DE63DB10-975F-460D-AF85-572C17A91284}.Debug|x86.Build.0 = Debug|Any CPU
{DE63DB10-975F-460D-AF85-572C17A91284}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE63DB10-975F-460D-AF85-572C17A91284}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DE63DB10-975F-460D-AF85-572C17A91284}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {DE63DB10-975F-460D-AF85-572C17A91284}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {DE63DB10-975F-460D-AF85-572C17A91284}.Release|x86.ActiveCfg = Release|Any CPU
{B2C0D749-CE34-4F62-A15E-00CB2FF5DDB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2C0D749-CE34-4F62-A15E-00CB2FF5DDB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B2C0D749-CE34-4F62-A15E-00CB2FF5DDB3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {B2C0D749-CE34-4F62-A15E-00CB2FF5DDB3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {B2C0D749-CE34-4F62-A15E-00CB2FF5DDB3}.Debug|x86.ActiveCfg = Debug|Any CPU
{B2C0D749-CE34-4F62-A15E-00CB2FF5DDB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2C0D749-CE34-4F62-A15E-00CB2FF5DDB3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B2C0D749-CE34-4F62-A15E-00CB2FF5DDB3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {B2C0D749-CE34-4F62-A15E-00CB2FF5DDB3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {B2C0D749-CE34-4F62-A15E-00CB2FF5DDB3}.Release|x86.ActiveCfg = Release|Any CPU
{69D7956C-C2CC-4708-B399-A188FEC384C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69D7956C-C2CC-4708-B399-A188FEC384C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {69D7956C-C2CC-4708-B399-A188FEC384C4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {69D7956C-C2CC-4708-B399-A188FEC384C4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {69D7956C-C2CC-4708-B399-A188FEC384C4}.Debug|x86.ActiveCfg = Debug|Any CPU
{69D7956C-C2CC-4708-B399-A188FEC384C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69D7956C-C2CC-4708-B399-A188FEC384C4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {69D7956C-C2CC-4708-B399-A188FEC384C4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {69D7956C-C2CC-4708-B399-A188FEC384C4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {69D7956C-C2CC-4708-B399-A188FEC384C4}.Release|x86.ActiveCfg = Release|Any CPU
{48F7884A-9454-4E88-8413-9D35992CB440}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48F7884A-9454-4E88-8413-9D35992CB440}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {48F7884A-9454-4E88-8413-9D35992CB440}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {48F7884A-9454-4E88-8413-9D35992CB440}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {48F7884A-9454-4E88-8413-9D35992CB440}.Debug|x86.ActiveCfg = Debug|Any CPU
{48F7884A-9454-4E88-8413-9D35992CB440}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48F7884A-9454-4E88-8413-9D35992CB440}.Release|Any CPU.Build.0 = Release|Any CPU
+ {48F7884A-9454-4E88-8413-9D35992CB440}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {48F7884A-9454-4E88-8413-9D35992CB440}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {48F7884A-9454-4E88-8413-9D35992CB440}.Release|x86.ActiveCfg = Release|Any CPU
{4D77E491-F50F-4A0C-9BD9-F9AB655720AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D77E491-F50F-4A0C-9BD9-F9AB655720AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4D77E491-F50F-4A0C-9BD9-F9AB655720AD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {4D77E491-F50F-4A0C-9BD9-F9AB655720AD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {4D77E491-F50F-4A0C-9BD9-F9AB655720AD}.Debug|x86.ActiveCfg = Debug|Any CPU
{4D77E491-F50F-4A0C-9BD9-F9AB655720AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D77E491-F50F-4A0C-9BD9-F9AB655720AD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4D77E491-F50F-4A0C-9BD9-F9AB655720AD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {4D77E491-F50F-4A0C-9BD9-F9AB655720AD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {4D77E491-F50F-4A0C-9BD9-F9AB655720AD}.Release|x86.ActiveCfg = Release|Any CPU
{E067B8BB-D8E7-4040-BEB8-EFF8BB4149BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E067B8BB-D8E7-4040-BEB8-EFF8BB4149BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E067B8BB-D8E7-4040-BEB8-EFF8BB4149BD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {E067B8BB-D8E7-4040-BEB8-EFF8BB4149BD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {E067B8BB-D8E7-4040-BEB8-EFF8BB4149BD}.Debug|x86.ActiveCfg = Debug|Any CPU
{E067B8BB-D8E7-4040-BEB8-EFF8BB4149BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E067B8BB-D8E7-4040-BEB8-EFF8BB4149BD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E067B8BB-D8E7-4040-BEB8-EFF8BB4149BD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {E067B8BB-D8E7-4040-BEB8-EFF8BB4149BD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {E067B8BB-D8E7-4040-BEB8-EFF8BB4149BD}.Release|x86.ActiveCfg = Release|Any CPU
{866723F4-E3A4-47C5-A49F-9A68ADD4CFAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{866723F4-E3A4-47C5-A49F-9A68ADD4CFAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {866723F4-E3A4-47C5-A49F-9A68ADD4CFAE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {866723F4-E3A4-47C5-A49F-9A68ADD4CFAE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {866723F4-E3A4-47C5-A49F-9A68ADD4CFAE}.Debug|x86.ActiveCfg = Debug|Any CPU
{866723F4-E3A4-47C5-A49F-9A68ADD4CFAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{866723F4-E3A4-47C5-A49F-9A68ADD4CFAE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {866723F4-E3A4-47C5-A49F-9A68ADD4CFAE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {866723F4-E3A4-47C5-A49F-9A68ADD4CFAE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {866723F4-E3A4-47C5-A49F-9A68ADD4CFAE}.Release|x86.ActiveCfg = Release|Any CPU
{DC83004C-183A-4E1A-ABEA-4FE95B4BC079}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC83004C-183A-4E1A-ABEA-4FE95B4BC079}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DC83004C-183A-4E1A-ABEA-4FE95B4BC079}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {DC83004C-183A-4E1A-ABEA-4FE95B4BC079}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {DC83004C-183A-4E1A-ABEA-4FE95B4BC079}.Debug|x86.ActiveCfg = Debug|Any CPU
{DC83004C-183A-4E1A-ABEA-4FE95B4BC079}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC83004C-183A-4E1A-ABEA-4FE95B4BC079}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DC83004C-183A-4E1A-ABEA-4FE95B4BC079}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {DC83004C-183A-4E1A-ABEA-4FE95B4BC079}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {DC83004C-183A-4E1A-ABEA-4FE95B4BC079}.Release|x86.ActiveCfg = Release|Any CPU
{F4873D95-4300-4E83-AFFA-EF796495D0F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F4873D95-4300-4E83-AFFA-EF796495D0F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F4873D95-4300-4E83-AFFA-EF796495D0F0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {F4873D95-4300-4E83-AFFA-EF796495D0F0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {F4873D95-4300-4E83-AFFA-EF796495D0F0}.Debug|x86.ActiveCfg = Debug|Any CPU
{F4873D95-4300-4E83-AFFA-EF796495D0F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4873D95-4300-4E83-AFFA-EF796495D0F0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F4873D95-4300-4E83-AFFA-EF796495D0F0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {F4873D95-4300-4E83-AFFA-EF796495D0F0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {F4873D95-4300-4E83-AFFA-EF796495D0F0}.Release|x86.ActiveCfg = Release|Any CPU
{D7276EA2-71BE-4208-889B-B1BD48DBE023}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7276EA2-71BE-4208-889B-B1BD48DBE023}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D7276EA2-71BE-4208-889B-B1BD48DBE023}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {D7276EA2-71BE-4208-889B-B1BD48DBE023}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {D7276EA2-71BE-4208-889B-B1BD48DBE023}.Debug|x86.ActiveCfg = Debug|Any CPU
{D7276EA2-71BE-4208-889B-B1BD48DBE023}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7276EA2-71BE-4208-889B-B1BD48DBE023}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D7276EA2-71BE-4208-889B-B1BD48DBE023}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {D7276EA2-71BE-4208-889B-B1BD48DBE023}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {D7276EA2-71BE-4208-889B-B1BD48DBE023}.Release|x86.ActiveCfg = Release|Any CPU
{3F79B6D4-4359-4F83-B64F-07F4F6262425}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3F79B6D4-4359-4F83-B64F-07F4F6262425}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3F79B6D4-4359-4F83-B64F-07F4F6262425}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {3F79B6D4-4359-4F83-B64F-07F4F6262425}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {3F79B6D4-4359-4F83-B64F-07F4F6262425}.Debug|x86.ActiveCfg = Debug|Any CPU
{3F79B6D4-4359-4F83-B64F-07F4F6262425}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3F79B6D4-4359-4F83-B64F-07F4F6262425}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3F79B6D4-4359-4F83-B64F-07F4F6262425}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {3F79B6D4-4359-4F83-B64F-07F4F6262425}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {3F79B6D4-4359-4F83-B64F-07F4F6262425}.Release|x86.ActiveCfg = Release|Any CPU
{351B75B1-BBD5-4E32-8036-7BED4E0135A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{351B75B1-BBD5-4E32-8036-7BED4E0135A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {351B75B1-BBD5-4E32-8036-7BED4E0135A6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {351B75B1-BBD5-4E32-8036-7BED4E0135A6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {351B75B1-BBD5-4E32-8036-7BED4E0135A6}.Debug|x86.ActiveCfg = Debug|Any CPU
{351B75B1-BBD5-4E32-8036-7BED4E0135A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{351B75B1-BBD5-4E32-8036-7BED4E0135A6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {351B75B1-BBD5-4E32-8036-7BED4E0135A6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {351B75B1-BBD5-4E32-8036-7BED4E0135A6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {351B75B1-BBD5-4E32-8036-7BED4E0135A6}.Release|x86.ActiveCfg = Release|Any CPU
{E8A339C7-FCF6-4A72-8586-56D8961D7B99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E8A339C7-FCF6-4A72-8586-56D8961D7B99}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E8A339C7-FCF6-4A72-8586-56D8961D7B99}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {E8A339C7-FCF6-4A72-8586-56D8961D7B99}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {E8A339C7-FCF6-4A72-8586-56D8961D7B99}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {E8A339C7-FCF6-4A72-8586-56D8961D7B99}.Debug|x86.Build.0 = Debug|Any CPU
{E8A339C7-FCF6-4A72-8586-56D8961D7B99}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8A339C7-FCF6-4A72-8586-56D8961D7B99}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E8A339C7-FCF6-4A72-8586-56D8961D7B99}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {E8A339C7-FCF6-4A72-8586-56D8961D7B99}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {E8A339C7-FCF6-4A72-8586-56D8961D7B99}.Release|x86.ActiveCfg = Release|Any CPU
+ {E8A339C7-FCF6-4A72-8586-56D8961D7B99}.Release|x86.Build.0 = Release|Any CPU
{02BAB603-067D-48B1-AEDD-316849652568}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{02BAB603-067D-48B1-AEDD-316849652568}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {02BAB603-067D-48B1-AEDD-316849652568}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {02BAB603-067D-48B1-AEDD-316849652568}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {02BAB603-067D-48B1-AEDD-316849652568}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {02BAB603-067D-48B1-AEDD-316849652568}.Debug|x86.Build.0 = Debug|Any CPU
{02BAB603-067D-48B1-AEDD-316849652568}.Release|Any CPU.ActiveCfg = Release|Any CPU
{02BAB603-067D-48B1-AEDD-316849652568}.Release|Any CPU.Build.0 = Release|Any CPU
+ {02BAB603-067D-48B1-AEDD-316849652568}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {02BAB603-067D-48B1-AEDD-316849652568}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {02BAB603-067D-48B1-AEDD-316849652568}.Release|x86.ActiveCfg = Release|Any CPU
+ {02BAB603-067D-48B1-AEDD-316849652568}.Release|x86.Build.0 = Release|Any CPU
{4C1B794F-8158-45E6-85B3-2C46569BEBC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4C1B794F-8158-45E6-85B3-2C46569BEBC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4C1B794F-8158-45E6-85B3-2C46569BEBC2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {4C1B794F-8158-45E6-85B3-2C46569BEBC2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {4C1B794F-8158-45E6-85B3-2C46569BEBC2}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {4C1B794F-8158-45E6-85B3-2C46569BEBC2}.Debug|x86.Build.0 = Debug|Any CPU
{4C1B794F-8158-45E6-85B3-2C46569BEBC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C1B794F-8158-45E6-85B3-2C46569BEBC2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4C1B794F-8158-45E6-85B3-2C46569BEBC2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {4C1B794F-8158-45E6-85B3-2C46569BEBC2}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {4C1B794F-8158-45E6-85B3-2C46569BEBC2}.Release|x86.ActiveCfg = Release|Any CPU
+ {4C1B794F-8158-45E6-85B3-2C46569BEBC2}.Release|x86.Build.0 = Release|Any CPU
{4ADD0BBC-B900-4715-9526-D871DE8EEA64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4ADD0BBC-B900-4715-9526-D871DE8EEA64}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4ADD0BBC-B900-4715-9526-D871DE8EEA64}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {4ADD0BBC-B900-4715-9526-D871DE8EEA64}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {4ADD0BBC-B900-4715-9526-D871DE8EEA64}.Debug|x86.ActiveCfg = Debug|Any CPU
{4ADD0BBC-B900-4715-9526-D871DE8EEA64}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4ADD0BBC-B900-4715-9526-D871DE8EEA64}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4ADD0BBC-B900-4715-9526-D871DE8EEA64}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {4ADD0BBC-B900-4715-9526-D871DE8EEA64}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {4ADD0BBC-B900-4715-9526-D871DE8EEA64}.Release|x86.ActiveCfg = Release|Any CPU
{C54FE8FA-7986-4C94-B872-D5BFF7C6C74E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C54FE8FA-7986-4C94-B872-D5BFF7C6C74E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C54FE8FA-7986-4C94-B872-D5BFF7C6C74E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {C54FE8FA-7986-4C94-B872-D5BFF7C6C74E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {C54FE8FA-7986-4C94-B872-D5BFF7C6C74E}.Debug|x86.ActiveCfg = Debug|Any CPU
{C54FE8FA-7986-4C94-B872-D5BFF7C6C74E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C54FE8FA-7986-4C94-B872-D5BFF7C6C74E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C54FE8FA-7986-4C94-B872-D5BFF7C6C74E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {C54FE8FA-7986-4C94-B872-D5BFF7C6C74E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {C54FE8FA-7986-4C94-B872-D5BFF7C6C74E}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/src/Lucene.Net.Core/Codecs/Codec.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Codec.cs b/src/Lucene.Net.Core/Codecs/Codec.cs
index 1f53bb5..8af65d1 100644
--- a/src/Lucene.Net.Core/Codecs/Codec.cs
+++ b/src/Lucene.Net.Core/Codecs/Codec.cs
@@ -108,7 +108,7 @@ namespace Lucene.Net.Codecs
{
if (Loader == null)
{
- throw new InvalidOperationException("You called Codec.ForName() before all Codecs could be initialized. This likely happens if you call it from a Codec's ctor.");
+ throw new InvalidOperationException("You called Codec.forName() before all Codecs could be initialized. " + "this likely happens if you call it from a Codec's ctor.");
}
return Loader.Lookup(name);
}
@@ -119,7 +119,7 @@ namespace Lucene.Net.Codecs
{
if (Loader == null)
{
- throw new InvalidOperationException("You called Codec.AvailableCodecs() before all Codecs could be initialized. This likely happens if you call it from a Codec's ctor.");
+ throw new InvalidOperationException("You called Codec.availableCodecs() before all Codecs could be initialized. " + "this likely happens if you call it from a Codec's ctor.");
}
return Loader.AvailableServices();
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 ddfba5a..5d573a0 100644
--- a/src/Lucene.Net.Core/Lucene.Net.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.csproj
@@ -2,7 +2,7 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{5D4AD9BE-1FFB-41AB-9943-25737971BF57}</ProjectGuid>
<OutputType>Library</OutputType>
<NoStandardLibraries>false</NoStandardLibraries>
@@ -12,7 +12,7 @@
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
@@ -23,7 +23,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/src/Lucene.Net.Core/Util/NamedSPILoader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/NamedSPILoader.cs b/src/Lucene.Net.Core/Util/NamedSPILoader.cs
index ad262d8..bc1a4cb 100644
--- a/src/Lucene.Net.Core/Util/NamedSPILoader.cs
+++ b/src/Lucene.Net.Core/Util/NamedSPILoader.cs
@@ -1,6 +1,5 @@
using Lucene.Net.Support;
using System;
-using System.Linq;
using System.Collections.Generic;
namespace Lucene.Net.Util
@@ -116,10 +115,7 @@ namespace Lucene.Net.Util
{
return service;
}
- var availableServices = string.Join(", ", AvailableServices());
- throw new ArgumentException("An SPI class of type " + Clazz.Name + " with name '" + name + "' does not exist. "
- + "You need to reference the corresponding assembly that contains the class. "
- + "The current NamedSPILoader supports the following names: " + availableServices);
+ throw new System.ArgumentException("A SPI class of type " + Clazz.Name + " with name '" + name + "' does not exist. " + "You need to add the corresponding JAR file supporting this SPI to your classpath." + "The current classpath supports the following names: " + AvailableServices());
}
public ISet<string> AvailableServices()
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/src/Lucene.Net.Core/packages.config
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/packages.config b/src/Lucene.Net.Core/packages.config
index c74b92e..40ec27e 100644
--- a/src/Lucene.Net.Core/packages.config
+++ b/src/Lucene.Net.Core/packages.config
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.0.34" targetFramework="net451" />
+ <package id="SharpZipLib" version="0.86.0" targetFramework="net40-Client" />
</packages>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 bb1098c..9dbd673 100644
--- a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
@@ -1,4 +1,5 @@
using System.Linq;
+using Apache.NMS.Util;
using Lucene.Net.Documents;
using Lucene.Net.Index;
using NUnit.Framework;
@@ -559,14 +560,14 @@ namespace Lucene.Net.Analysis
internal readonly bool Simple;
internal readonly bool OffsetsAreCorrect;
internal readonly RandomIndexWriter Iw;
- private readonly CountdownEvent _latch;
+ private readonly CountDownLatch _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, /*CountdownEvent latch,*/ Analyzer a, int iterations, int maxWordLength, bool useCharFilter, bool simple, bool offsetsAreCorrect, RandomIndexWriter iw)
+ internal AnalysisThread(long seed, /*CountDownLatch latch,*/ Analyzer a, int iterations, int maxWordLength, bool useCharFilter, bool simple, bool offsetsAreCorrect, RandomIndexWriter iw)
{
this.Seed = seed;
this.a = a;
@@ -584,7 +585,7 @@ namespace Lucene.Net.Analysis
bool success = false;
try
{
- if (_latch != null) _latch.Wait();
+ if (_latch != null) _latch.await();
// 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);
@@ -630,7 +631,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 CountdownEvent(1);
+ var startingGun = new CountDownLatch(1);
var threads = new AnalysisThread[numThreads];
for (int i = 0; i < threads.Length; i++)
{
@@ -639,7 +640,7 @@ namespace Lucene.Net.Analysis
Array.ForEach(threads, thread => thread.Start());
- startingGun.Signal();
+ startingGun.countDown();
foreach (var t in threads)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 9be51c3..ae7e1fc 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];
- CountdownEvent startingGun = new CountdownEvent(1);
+ CountDownLatch startingGun = new CountDownLatch(1);
for (int i = 0; i < threads.Length; i++)
{
threads[i] = new ThreadAnonymousInnerClassHelper(this, ir, startingGun);
threads[i].Start();
}
- startingGun.Signal();
+ startingGun.countDown();
foreach (ThreadClass t in threads)
{
t.Join();
@@ -3230,9 +3230,9 @@ namespace Lucene.Net.Index
private readonly BaseDocValuesFormatTestCase OuterInstance;
private DirectoryReader Ir;
- private CountdownEvent StartingGun;
+ private CountDownLatch StartingGun;
- public ThreadAnonymousInnerClassHelper(BaseDocValuesFormatTestCase outerInstance, DirectoryReader ir, CountdownEvent startingGun)
+ public ThreadAnonymousInnerClassHelper(BaseDocValuesFormatTestCase outerInstance, DirectoryReader ir, CountDownLatch startingGun)
{
this.OuterInstance = outerInstance;
this.Ir = ir;
@@ -3243,7 +3243,7 @@ namespace Lucene.Net.Index
{
try
{
- StartingGun.Wait();
+ StartingGun.@await();
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];
- CountdownEvent startingGun = new CountdownEvent(1);
+ CountDownLatch startingGun = new CountDownLatch(1);
for (int i = 0; i < threads.Length; i++)
{
threads[i] = new ThreadAnonymousInnerClassHelper2(this, ir, startingGun);
threads[i].Start();
}
- startingGun.Signal();
+ startingGun.countDown();
foreach (ThreadClass t in threads)
{
t.Join();
@@ -3368,9 +3368,9 @@ namespace Lucene.Net.Index
private readonly BaseDocValuesFormatTestCase OuterInstance;
private DirectoryReader Ir;
- private CountdownEvent StartingGun;
+ private CountDownLatch StartingGun;
- public ThreadAnonymousInnerClassHelper2(BaseDocValuesFormatTestCase outerInstance, DirectoryReader ir, CountdownEvent startingGun)
+ public ThreadAnonymousInnerClassHelper2(BaseDocValuesFormatTestCase outerInstance, DirectoryReader ir, CountDownLatch startingGun)
{
this.OuterInstance = outerInstance;
this.Ir = ir;
@@ -3381,7 +3381,7 @@ namespace Lucene.Net.Index
{
try
{
- StartingGun.Wait();
+ StartingGun.@await();
foreach (AtomicReaderContext context in Ir.Leaves)
{
AtomicReader r = context.AtomicReader;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 dc964c2..6f202a5 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
@@ -1,3 +1,4 @@
+using Apache.NMS.Util;
using Lucene.Net.Attributes;
using Lucene.Net.Codecs;
using Lucene.Net.Documents;
@@ -9,7 +10,6 @@ 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>();
- Exception ex = null;
+ AtomicReference<Exception> ex = new AtomicReference<Exception>();
for (int i = 0; i < concurrentReads; ++i)
{
readThreads.Add(new ThreadAnonymousInnerClassHelper(numDocs, rd, searcher, readsPerThread, ex, i));
@@ -486,9 +486,9 @@ namespace Lucene.Net.Index
thread.Join();
}
rd.Dispose();
- if (ex != null)
+ if (ex.Value != null)
{
- throw ex;
+ throw ex.Value;
}
iw.Dispose();
@@ -501,11 +501,11 @@ namespace Lucene.Net.Index
private readonly DirectoryReader Rd;
private readonly IndexSearcher Searcher;
private int ReadsPerThread;
- private Exception Ex;
+ private AtomicReference<Exception> Ex;
private int i;
private readonly int[] queries;
- public ThreadAnonymousInnerClassHelper(int numDocs, DirectoryReader rd, IndexSearcher searcher, int readsPerThread, Exception ex, int i)
+ public ThreadAnonymousInnerClassHelper(int numDocs, DirectoryReader rd, IndexSearcher searcher, int readsPerThread, AtomicReference<Exception> ex, int i)
{
this.NumDocs = numDocs;
this.Rd = rd;
@@ -546,7 +546,8 @@ namespace Lucene.Net.Index
}
catch (Exception e)
{
- Interlocked.Exchange(ref Ex, e);
+ Ex.GetAndSet(e);
+ //Ex.compareAndSet(null, e);
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 611766e..54c689d 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
@@ -1,3 +1,4 @@
+using Apache.NMS.Util;
using Lucene.Net.Analysis.Tokenattributes;
using System;
using System.Collections.Generic;
@@ -889,7 +890,7 @@ namespace Lucene.Net.Index
AssertEquals(docs[i], reader.GetTermVectors(docID));
}
- Exception exception = null;
+ AtomicReference<Exception> exception = new AtomicReference<Exception>();
ThreadClass[] threads = new ThreadClass[2];
for (int i = 0; i < threads.Length; ++i)
{
@@ -906,7 +907,7 @@ namespace Lucene.Net.Index
reader.Dispose();
writer.Dispose();
dir.Dispose();
- Assert.IsNull(exception, "One thread threw an exception");
+ Assert.IsNull(exception.Value, "One thread threw an exception");
}
}
@@ -917,10 +918,10 @@ namespace Lucene.Net.Index
private int NumDocs;
private Lucene.Net.Index.BaseTermVectorsFormatTestCase.RandomDocument[] Docs;
private IndexReader Reader;
- private Exception ARException;
+ private AtomicReference<Exception> ARException;
private int i;
- public ThreadAnonymousInnerClassHelper(BaseTermVectorsFormatTestCase outerInstance, int numDocs, Lucene.Net.Index.BaseTermVectorsFormatTestCase.RandomDocument[] docs, IndexReader reader, Exception exception, int i)
+ public ThreadAnonymousInnerClassHelper(BaseTermVectorsFormatTestCase outerInstance, int numDocs, Lucene.Net.Index.BaseTermVectorsFormatTestCase.RandomDocument[] docs, IndexReader reader, AtomicReference<Exception> exception, int i)
{
this.OuterInstance = outerInstance;
this.NumDocs = numDocs;
@@ -943,7 +944,7 @@ namespace Lucene.Net.Index
}
catch (Exception t)
{
- Interlocked.Exchange(ref ARException, t);
+ ARException.Value = t;
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 a4390b4..dfc076b 100644
--- a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
+++ b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
@@ -43,6 +43,12 @@
</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/a5e8c8b6/src/Lucene.Net.TestFramework/packages.config
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/packages.config b/src/Lucene.Net.TestFramework/packages.config
index 967502d..ffa0c4a 100644
--- a/src/Lucene.Net.TestFramework/packages.config
+++ b/src/Lucene.Net.TestFramework/packages.config
@@ -1,4 +1,6 @@
<?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/a5e8c8b6/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 ed2749d..c3730df 100644
--- a/src/Lucene.Net.Tests.Facet/AssertingSubDocsAtOnceCollector.cs
+++ b/src/Lucene.Net.Tests.Facet/AssertingSubDocsAtOnceCollector.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Apache.NMS;
namespace Lucene.Net.Facet
{
@@ -25,7 +26,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.
@@ -62,7 +63,7 @@ namespace Lucene.Net.Facet
{
if (docID != s.DocID())
{
- throw new InvalidOperationException("subScorer=" + s + " has docID=" + s.DocID() + " != collected docID=" + docID);
+ throw new IllegalStateException("subScorer=" + s + " has docID=" + s.DocID() + " != collected docID=" + docID);
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 767e3d0..6d95c42 100644
--- a/src/Lucene.Net.Tests.Facet/Lucene.Net.Tests.Facet.csproj
+++ b/src/Lucene.Net.Tests.Facet/Lucene.Net.Tests.Facet.csproj
@@ -30,6 +30,9 @@
<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/a5e8c8b6/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 b0a1277..dd93d18 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Threading;
+using Apache.NMS;
using Lucene.Net.Support;
using NUnit.Framework;
@@ -338,7 +339,7 @@ namespace Lucene.Net.Facet.Taxonomy
mgr.MaybeRefresh();
Fail("should have hit exception");
}
- catch (InvalidOperationException)
+ catch (IllegalStateException)
{
// expected
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 139d513..f0ed309 100644
--- a/src/Lucene.Net.Tests.Facet/packages.config
+++ b/src/Lucene.Net.Tests.Facet/packages.config
@@ -1,4 +1,5 @@
<?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/a5e8c8b6/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 312fbdd..d6cd6d1 100644
--- a/src/Lucene.Net.Tests.Join/Lucene.Net.Tests.Join.csproj
+++ b/src/Lucene.Net.Tests.Join/Lucene.Net.Tests.Join.csproj
@@ -30,6 +30,10 @@
<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/a5e8c8b6/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 637cd4a..5fdd35f 100644
--- a/src/Lucene.Net.Tests.Join/TestBlockJoinValidation.cs
+++ b/src/Lucene.Net.Tests.Join/TestBlockJoinValidation.cs
@@ -1,6 +1,7 @@
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/a5e8c8b6/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 139d513..f0ed309 100644
--- a/src/Lucene.Net.Tests.Join/packages.config
+++ b/src/Lucene.Net.Tests.Join/packages.config
@@ -1,4 +1,5 @@
<?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/a5e8c8b6/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 fb7d438..6be5a97 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -38,6 +38,13 @@
<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>
@@ -147,7 +154,6 @@
<Compile Include="core\Codecs\Perfield\TestPerFieldDocValuesFormat.cs" />
<Compile Include="core\Codecs\Perfield\TestPerFieldPostingsFormat.cs" />
<Compile Include="core\Codecs\Perfield\TestPerFieldPostingsFormat2.cs" />
- <Compile Include="core\Codecs\TestCodec.cs" />
<Compile Include="core\Document\TestBinaryDocument.cs" />
<Compile Include="core\Document\TestDateTools.cs" />
<Compile Include="core\Document\TestDocument.cs" />
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/src/Lucene.Net.Tests/core/Codecs/TestCodec.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/TestCodec.cs b/src/Lucene.Net.Tests/core/Codecs/TestCodec.cs
deleted file mode 100644
index f8d005f..0000000
--- a/src/Lucene.Net.Tests/core/Codecs/TestCodec.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System;
-using NUnit.Framework;
-using System.Collections.Generic;
-
-namespace Lucene.Net.Codecs
-{
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
- [TestFixture]
- public class TestCodec
- {
- [Test]
- public void TestLookup()
- {
- Codec codec = Codec.ForName("Lucene46");
- Assert.AreEqual("Lucene46", codec.Name);
- }
-
- // we want an exception if its not found.
- [Test]
- public void TestBogusLookup()
- {
- Assert.Throws<ArgumentException>(() => Codec.ForName("dskfdskfsdfksdfdsf"));
- }
-
- [Test]
- public void TestAvailableServices()
- {
- ISet<string> codecs = Codec.AvailableCodecs();
- Assert.IsTrue(codecs.Contains("Lucene46"));
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 12cdc72..e7cf985 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];
- CountdownEvent startingGun = new CountdownEvent(1);
+ CountDownLatch startingGun = new CountDownLatch(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.Signal();
+ startingGun.countDown();
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 CountdownEvent StartingGun;
+ private CountDownLatch StartingGun;
private Random ThreadRandom;
private Document Document;
private Field Field;
- public ThreadAnonymousInnerClassHelper(TestBagOfPositions outerInstance, int numTerms, int maxTermsPerDoc, ConcurrentQueue<string> postings, RandomIndexWriter iw, CountdownEvent startingGun, Random threadRandom, Document document, Field field)
+ public ThreadAnonymousInnerClassHelper(TestBagOfPositions outerInstance, int numTerms, int maxTermsPerDoc, ConcurrentQueue<string> postings, RandomIndexWriter iw, CountDownLatch startingGun, Random threadRandom, Document document, Field field)
{
this.OuterInstance = outerInstance;
this.NumTerms = numTerms;
@@ -178,7 +178,7 @@ namespace Lucene.Net.Index
{
try
{
- StartingGun.Wait();
+ StartingGun.@await();
while (!(Postings.Count == 0))
{
StringBuilder text = new StringBuilder();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 1650604..38d6886 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];
- CountdownEvent startingGun = new CountdownEvent(1);
+ CountDownLatch startingGun = new CountDownLatch(1);
for (int threadID = 0; threadID < threadCount; threadID++)
{
threads[threadID] = new ThreadAnonymousInnerClassHelper(this, maxTermsPerDoc, postings, iw, startingGun);
threads[threadID].Start();
}
- startingGun.Signal();
+ startingGun.countDown();
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 CountdownEvent StartingGun;
+ private CountDownLatch StartingGun;
- public ThreadAnonymousInnerClassHelper(TestBagOfPostings outerInstance, int maxTermsPerDoc, ConcurrentQueue<string> postings, RandomIndexWriter iw, CountdownEvent startingGun)
+ public ThreadAnonymousInnerClassHelper(TestBagOfPostings outerInstance, int maxTermsPerDoc, ConcurrentQueue<string> postings, RandomIndexWriter iw, CountDownLatch 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.Wait();
+ StartingGun.@await();
while (!(Postings.Count == 0))
{
StringBuilder text = new StringBuilder();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 23324b5..9f49a59 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);
}
- CountdownEvent done = new CountdownEvent(numThreads);
+ CountDownLatch done = new CountDownLatch(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.Wait();
+ done.@await();
writer.Dispose();
DirectoryReader reader = DirectoryReader.Open(dir);
@@ -1242,12 +1242,12 @@ namespace Lucene.Net.Index
private IndexWriter Writer;
private int NumDocs;
- private CountdownEvent Done;
+ private CountDownLatch Done;
private AtomicInteger NumUpdates;
private string f;
private string Cf;
- public ThreadAnonymousInnerClassHelper(TestBinaryDocValuesUpdates outerInstance, string str, IndexWriter writer, int numDocs, CountdownEvent done, AtomicInteger numUpdates, string f, string cf)
+ public ThreadAnonymousInnerClassHelper(TestBinaryDocValuesUpdates outerInstance, string str, IndexWriter writer, int numDocs, CountDownLatch done, AtomicInteger numUpdates, string f, string cf)
: base(str)
{
this.OuterInstance = outerInstance;
@@ -1355,7 +1355,7 @@ namespace Lucene.Net.Index
}
}
}
- Done.Signal();
+ Done.countDown();
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 14397b9..b137300 100644
--- a/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
@@ -1,3 +1,4 @@
+using Apache.NMS.Util;
using System;
using System.Diagnostics;
using System.Threading;
@@ -300,7 +301,7 @@ namespace Lucene.Net.Index
int maxMergeCount = TestUtil.NextInt(Random(), 1, 5);
int maxMergeThreads = TestUtil.NextInt(Random(), 1, maxMergeCount);
- CountdownEvent enoughMergesWaiting = new CountdownEvent(maxMergeCount);
+ CountDownLatch enoughMergesWaiting = new CountDownLatch(maxMergeCount);
AtomicInteger runningMergeCount = new AtomicInteger(0);
AtomicBoolean failed = new AtomicBoolean();
@@ -322,7 +323,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.CurrentCount != 0 && !failed.Get())
+ while (enoughMergesWaiting.Remaining != 0 && !failed.Get())
{
for (int i = 0; i < 10; i++)
{
@@ -338,11 +339,11 @@ namespace Lucene.Net.Index
private readonly TestConcurrentMergeScheduler OuterInstance;
private int MaxMergeCount;
- private CountdownEvent EnoughMergesWaiting;
+ private CountDownLatch EnoughMergesWaiting;
private AtomicInteger RunningMergeCount;
private AtomicBoolean Failed;
- public ConcurrentMergeSchedulerAnonymousInnerClassHelper(TestConcurrentMergeScheduler outerInstance, int maxMergeCount, CountdownEvent enoughMergesWaiting, AtomicInteger runningMergeCount, AtomicBoolean failed)
+ public ConcurrentMergeSchedulerAnonymousInnerClassHelper(TestConcurrentMergeScheduler outerInstance, int maxMergeCount, CountDownLatch enoughMergesWaiting, AtomicInteger runningMergeCount, AtomicBoolean failed)
{
this.OuterInstance = outerInstance;
this.MaxMergeCount = maxMergeCount;
@@ -361,14 +362,14 @@ namespace Lucene.Net.Index
try
{
Assert.IsTrue(count <= MaxMergeCount, "count=" + count + " vs maxMergeCount=" + MaxMergeCount);
- EnoughMergesWaiting.Signal();
+ EnoughMergesWaiting.countDown();
// Stall this merge until we see exactly
// maxMergeCount merges waiting
while (true)
{
// wait for 10 milliseconds
- if (EnoughMergesWaiting.Wait(new TimeSpan(0, 0, 0, 0, 10)) || Failed.Get())
+ if (EnoughMergesWaiting.@await(new TimeSpan(0, 0, 0, 0, 10)) || Failed.Get())
{
break;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 0a50535..a09265a 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())));
- CountdownEvent startingGun = new CountdownEvent(1);
+ CountDownLatch startingGun = new CountDownLatch(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.Signal();
+ startingGun.countDown();
foreach (ThreadClass t in threads)
{
@@ -551,11 +551,11 @@ namespace Lucene.Net.Index
private readonly TestDocValuesIndexing OuterInstance;
private IndexWriter w;
- private CountdownEvent StartingGun;
+ private CountDownLatch StartingGun;
private AtomicBoolean HitExc;
private Document Doc;
- public ThreadAnonymousInnerClassHelper(TestDocValuesIndexing outerInstance, IndexWriter w, CountdownEvent startingGun, AtomicBoolean hitExc, Document doc)
+ public ThreadAnonymousInnerClassHelper(TestDocValuesIndexing outerInstance, IndexWriter w, CountDownLatch startingGun, AtomicBoolean hitExc, Document doc)
{
this.OuterInstance = outerInstance;
this.w = w;
@@ -568,7 +568,7 @@ namespace Lucene.Net.Index
{
try
{
- StartingGun.Wait();
+ StartingGun.@await();
w.AddDocument(Doc);
}
catch (System.ArgumentException iae)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 5d29a06..4fc262e 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>();
- CountdownEvent startingGun = new CountdownEvent(1);
+ CountDownLatch startingGun = new CountDownLatch(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.Signal();
+ startingGun.countDown();
foreach (ThreadClass thread in threads)
{
@@ -104,10 +104,10 @@ namespace Lucene.Net.Index
private IList<BytesRef> Sorted;
private int NumDocs;
private AtomicReader Ar;
- private CountdownEvent StartingGun;
+ private CountDownLatch StartingGun;
private Random ThreadRandom;
- public ThreadAnonymousInnerClassHelper(TestDocValuesWithThreads outerInstance, IList<long?> numbers, IList<BytesRef> binary, IList<BytesRef> sorted, int numDocs, AtomicReader ar, CountdownEvent startingGun, Random threadRandom)
+ public ThreadAnonymousInnerClassHelper(TestDocValuesWithThreads outerInstance, IList<long?> numbers, IList<BytesRef> binary, IList<BytesRef> sorted, int numDocs, AtomicReader ar, CountDownLatch 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.Wait();
+ StartingGun.@await();
int iters = AtLeast(1000);
BytesRef scratch = new BytesRef();
BytesRef scratch2 = new BytesRef();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 dcd3212..3b017ce 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterDeleteQueue.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterDeleteQueue.cs
@@ -1,4 +1,5 @@
using System.Threading;
+using Apache.NMS.Util;
using Lucene.Net.Search;
using System;
using System.Collections;
@@ -218,7 +219,7 @@ namespace Lucene.Net.Index
ids[i] = Random().Next();
uniqueValues.Add(new Term("id", ids[i].ToString()));
}
- CountdownEvent latch = new CountdownEvent(1);
+ CountDownLatch latch = new CountDownLatch(1);
AtomicInteger index = new AtomicInteger(0);
int numThreads = 2 + Random().Next(5);
UpdateThread[] threads = new UpdateThread[numThreads];
@@ -227,7 +228,7 @@ namespace Lucene.Net.Index
threads[i] = new UpdateThread(queue, index, ids, latch);
threads[i].Start();
}
- latch.Signal();
+ latch.countDown();
for (int i = 0; i < threads.Length; i++)
{
threads[i].Join();
@@ -261,9 +262,9 @@ namespace Lucene.Net.Index
internal readonly int?[] Ids;
internal readonly DeleteSlice Slice;
internal readonly BufferedUpdates Deletes;
- internal readonly CountdownEvent Latch;
+ internal readonly CountDownLatch Latch;
- protected internal UpdateThread(DocumentsWriterDeleteQueue queue, AtomicInteger index, int?[] ids, CountdownEvent latch)
+ protected internal UpdateThread(DocumentsWriterDeleteQueue queue, AtomicInteger index, int?[] ids, CountDownLatch latch)
{
this.Queue = queue;
this.Index = index;
@@ -277,7 +278,7 @@ namespace Lucene.Net.Index
{
try
{
- Latch.Wait();
+ Latch.@await();
}
catch (ThreadInterruptedException e)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 5887c18..9c0b80d 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterStallControl.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterStallControl.cs
@@ -1,3 +1,4 @@
+using Apache.NMS.Util;
using System;
using System.Collections.Generic;
using System.Threading;
@@ -149,7 +150,7 @@ namespace Lucene.Net.Index
{
if (checkPoint.Get())
{
- Assert.IsTrue(sync.UpdateJoin.Wait(new TimeSpan(0, 0, 0, 10)), "timed out waiting for update threads - deadlock?");
+ Assert.IsTrue(sync.UpdateJoin.@await(new TimeSpan(0, 0, 0, 10)), "timed out waiting for update threads - deadlock?");
if (exceptions.Count > 0)
{
foreach (Exception throwable in exceptions)
@@ -166,11 +167,11 @@ namespace Lucene.Net.Index
}
checkPoint.Set(false);
- sync.Waiter.Signal();
- sync.LeftCheckpoint.Wait();
+ sync.Waiter.countDown();
+ sync.LeftCheckpoint.@await();
}
Assert.IsFalse(checkPoint.Get());
- Assert.AreEqual(0, sync.Waiter.CurrentCount);
+ Assert.AreEqual(0, sync.Waiter.Remaining);
if (checkPointProbability >= (float)Random().NextDouble())
{
sync.Reset(numStallers + numReleasers, numStallers + numReleasers + numWaiters);
@@ -183,12 +184,12 @@ namespace Lucene.Net.Index
checkPoint.Set(true);
}
- Assert.IsTrue(sync.UpdateJoin.Wait(new TimeSpan(0, 0, 0, 10)));
+ Assert.IsTrue(sync.UpdateJoin.@await(new TimeSpan(0, 0, 0, 10)));
AssertState(numReleasers, numStallers, numWaiters, threads, ctrl);
checkPoint.Set(false);
stop.Set(true);
- sync.Waiter.Signal();
- sync.LeftCheckpoint.Wait();
+ sync.Waiter.countDown();
+ sync.LeftCheckpoint.@await();
for (int i = 0; i < threads.Length; i++)
{
@@ -265,11 +266,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.CurrentCount);
+ Console.WriteLine("[Waiter] got interrupted - wait count: " + Sync.Waiter.Remaining);
throw new ThreadInterruptedException("Thread Interrupted Exception", e);
}
}
@@ -317,17 +318,17 @@ namespace Lucene.Net.Index
}
if (CheckPoint.Get())
{
- Sync.UpdateJoin.Signal();
+ Sync.UpdateJoin.countDown();
try
{
- Assert.IsTrue(Sync.await());
+ Assert.IsTrue(Sync.@await());
}
catch (ThreadInterruptedException e)
{
- Console.WriteLine("[Updater] got interrupted - wait count: " + Sync.Waiter.CurrentCount);
+ Console.WriteLine("[Updater] got interrupted - wait count: " + Sync.Waiter.Remaining);
throw new ThreadInterruptedException("Thread Interrupted Exception", e);
}
- Sync.LeftCheckpoint.Signal();
+ Sync.LeftCheckpoint.countDown();
}
if (Random().NextBoolean())
{
@@ -341,7 +342,7 @@ namespace Lucene.Net.Index
Console.Write(e.StackTrace);
Exceptions.Add(e);
}
- Sync.UpdateJoin.Signal();
+ Sync.UpdateJoin.countDown();
}
}
@@ -433,9 +434,9 @@ namespace Lucene.Net.Index
public sealed class Synchronizer
{
- internal volatile CountdownEvent Waiter;
- internal volatile CountdownEvent UpdateJoin;
- internal volatile CountdownEvent LeftCheckpoint;
+ internal volatile CountDownLatch Waiter;
+ internal volatile CountDownLatch UpdateJoin;
+ internal volatile CountDownLatch LeftCheckpoint;
public Synchronizer(int numUpdater, int numThreads)
{
@@ -444,14 +445,14 @@ namespace Lucene.Net.Index
public void Reset(int numUpdaters, int numThreads)
{
- this.Waiter = new CountdownEvent(1);
- this.UpdateJoin = new CountdownEvent(numUpdaters);
- this.LeftCheckpoint = new CountdownEvent(numUpdaters);
+ this.Waiter = new CountDownLatch(1);
+ this.UpdateJoin = new CountDownLatch(numUpdaters);
+ this.LeftCheckpoint = new CountDownLatch(numUpdaters);
}
public bool @await()
{
- return Waiter.Wait(new TimeSpan(0, 0, 0, 10));
+ return Waiter.@await(new TimeSpan(0, 0, 0, 10));
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 cce436e..bf68f4f 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
@@ -1,3 +1,4 @@
+using Apache.NMS.Util;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -335,17 +336,17 @@ namespace Lucene.Net.Index
RandomIndexWriter modifier = new RandomIndexWriter(Random(), dir);
int numThreads = AtLeast(2);
ThreadClass[] threads = new ThreadClass[numThreads];
- CountdownEvent latch = new CountdownEvent(1);
- CountdownEvent doneLatch = new CountdownEvent(numThreads);
+ CountDownLatch latch = new CountDownLatch(1);
+ CountDownLatch doneLatch = new CountDownLatch(numThreads);
for (int i = 0; i < numThreads; i++)
{
int offset = i;
threads[i] = new ThreadAnonymousInnerClassHelper(this, modifier, latch, doneLatch, offset);
threads[i].Start();
}
- latch.Signal();
+ latch.countDown();
//Wait for 1 millisecond
- while (!doneLatch.Wait(new TimeSpan(0, 0, 0, 0, 1)))
+ while (!doneLatch.@await(new TimeSpan(0, 0, 0, 0, 1)))
{
modifier.DeleteAll();
if (VERBOSE)
@@ -375,11 +376,11 @@ namespace Lucene.Net.Index
private readonly TestIndexWriterDelete OuterInstance;
private RandomIndexWriter Modifier;
- private CountdownEvent Latch;
- private CountdownEvent DoneLatch;
+ private CountDownLatch Latch;
+ private CountDownLatch DoneLatch;
private int Offset;
- public ThreadAnonymousInnerClassHelper(TestIndexWriterDelete outerInstance, RandomIndexWriter modifier, CountdownEvent latch, CountdownEvent doneLatch, int offset)
+ public ThreadAnonymousInnerClassHelper(TestIndexWriterDelete outerInstance, RandomIndexWriter modifier, CountDownLatch latch, CountDownLatch doneLatch, int offset)
{
this.OuterInstance = outerInstance;
this.Modifier = modifier;
@@ -394,7 +395,7 @@ namespace Lucene.Net.Index
int value = 100;
try
{
- Latch.Wait();
+ Latch.@await();
for (int j = 0; j < 1000; j++)
{
Document doc = new Document();
@@ -418,7 +419,7 @@ namespace Lucene.Net.Index
}
finally
{
- DoneLatch.Signal();
+ DoneLatch.countDown();
if (VERBOSE)
{
Console.WriteLine("\tThread[" + Offset + "]: done indexing");
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5e8c8b6/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 b93c2f3..2e46d17 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterNRTIsCurrent.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterNRTIsCurrent.cs
@@ -1,3 +1,4 @@
+using Apache.NMS.Util;
using System;
using System.Threading;
using Lucene.Net.Documents;
@@ -51,7 +52,7 @@ namespace Lucene.Net.Index
IndexWriter writer = new IndexWriter(dir, conf);
ReaderHolder holder = new ReaderHolder();
ReaderThread[] threads = new ReaderThread[AtLeast(3)];
- CountdownEvent latch = new CountdownEvent(1);
+ CountDownLatch latch = new CountDownLatch(1);
WriterThread writerThread = new WriterThread(holder, writer, AtLeast(500), Random(), latch);
for (int i = 0; i < threads.Length; i++)
{
@@ -88,10 +89,10 @@ namespace Lucene.Net.Index
internal readonly IndexWriter Writer;
internal readonly int NumOps;
internal bool Countdown = true;
- internal readonly CountdownEvent Latch;
+ internal readonly CountDownLatch Latch;
internal Exception Failed;
- internal WriterThread(ReaderHolder holder, IndexWriter writer, int numOps, Random random, CountdownEvent latch)
+ internal WriterThread(ReaderHolder holder, IndexWriter writer, int numOps, Random random, CountDownLatch latch)
: base()
{
this.Holder = holder;
@@ -134,7 +135,7 @@ namespace Lucene.Net.Index
if (Countdown)
{
Countdown = false;
- Latch.Signal();
+ Latch.countDown();
}
}
if (random.NextBoolean())
@@ -162,7 +163,7 @@ namespace Lucene.Net.Index
Holder.Reader = null;
if (Countdown)
{
- Latch.Signal();
+ Latch.countDown();
}
if (currentReader != null)
{
@@ -185,10 +186,10 @@ namespace Lucene.Net.Index
public sealed class ReaderThread : ThreadClass
{
internal readonly ReaderHolder Holder;
- internal readonly CountdownEvent Latch;
+ internal readonly CountDownLatch Latch;
internal Exception Failed;
- internal ReaderThread(ReaderHolder holder, CountdownEvent latch)
+ internal ReaderThread(ReaderHolder holder, CountDownLatch latch)
: base()
{
this.Holder = holder;
@@ -199,7 +200,7 @@ namespace Lucene.Net.Index
{
try
{
- Latch.Wait();
+ Latch.@await();
}
catch (ThreadInterruptedException e)
{