mirror of https://github.com/apache/lucene.git
don't hardcode the static default, restore in a try/finally instead
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@912335 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cc19884a86
commit
2f1e68a298
|
@ -82,12 +82,16 @@ public class TestIndexWriter extends LuceneTestCase {
|
|||
IndexReader reader = null;
|
||||
int i;
|
||||
|
||||
IndexWriter.setDefaultWriteLockTimeout(2000);
|
||||
assertEquals(2000, IndexWriter.getDefaultWriteLockTimeout());
|
||||
long savedWriteLockTimeout = IndexWriter.getDefaultWriteLockTimeout();
|
||||
try {
|
||||
IndexWriter.setDefaultWriteLockTimeout(2000);
|
||||
assertEquals(2000, IndexWriter.getDefaultWriteLockTimeout());
|
||||
|
||||
writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), IndexWriter.MaxFieldLength.LIMITED);
|
||||
writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), IndexWriter.MaxFieldLength.LIMITED);
|
||||
|
||||
IndexWriter.setDefaultWriteLockTimeout(1000);
|
||||
} finally {
|
||||
IndexWriter.setDefaultWriteLockTimeout(savedWriteLockTimeout);
|
||||
}
|
||||
|
||||
// add 100 documents
|
||||
for (i = 0; i < 100; i++) {
|
||||
|
|
Loading…
Reference in New Issue