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:
Robert Muir 2010-02-21 11:52:22 +00:00
parent cc19884a86
commit 2f1e68a298
1 changed files with 8 additions and 4 deletions

View File

@ -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++) {