mirror of https://github.com/apache/lucene.git
LUCENE-6525: remove deprecations from trunk
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1685498 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
03cafc6711
commit
e3563120b5
|
@ -59,7 +59,6 @@ import org.apache.lucene.store.Lock;
|
||||||
import org.apache.lucene.store.LockObtainFailedException;
|
import org.apache.lucene.store.LockObtainFailedException;
|
||||||
import org.apache.lucene.store.MergeInfo;
|
import org.apache.lucene.store.MergeInfo;
|
||||||
import org.apache.lucene.store.RateLimitedIndexOutput;
|
import org.apache.lucene.store.RateLimitedIndexOutput;
|
||||||
import org.apache.lucene.store.SleepingLockWrapper;
|
|
||||||
import org.apache.lucene.store.TrackingDirectoryWrapper;
|
import org.apache.lucene.store.TrackingDirectoryWrapper;
|
||||||
import org.apache.lucene.store.LockValidatingDirectoryWrapper;
|
import org.apache.lucene.store.LockValidatingDirectoryWrapper;
|
||||||
import org.apache.lucene.util.Accountable;
|
import org.apache.lucene.util.Accountable;
|
||||||
|
@ -759,15 +758,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
|
||||||
|
|
||||||
// obtain the write.lock. If the user configured a timeout,
|
// obtain the write.lock. If the user configured a timeout,
|
||||||
// we wrap with a sleeper and this might take some time.
|
// we wrap with a sleeper and this might take some time.
|
||||||
long timeout = config.getWriteLockTimeout();
|
writeLock = d.obtainLock(WRITE_LOCK_NAME);
|
||||||
final Directory lockDir;
|
|
||||||
if (timeout == 0) {
|
|
||||||
// user doesn't want sleep/retries
|
|
||||||
lockDir = d;
|
|
||||||
} else {
|
|
||||||
lockDir = new SleepingLockWrapper(d, timeout);
|
|
||||||
}
|
|
||||||
writeLock = lockDir.obtainLock(WRITE_LOCK_NAME);
|
|
||||||
|
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.apache.lucene.codecs.Codec;
|
||||||
import org.apache.lucene.index.DocumentsWriterPerThread.IndexingChain;
|
import org.apache.lucene.index.DocumentsWriterPerThread.IndexingChain;
|
||||||
import org.apache.lucene.index.IndexWriter.IndexReaderWarmer;
|
import org.apache.lucene.index.IndexWriter.IndexReaderWarmer;
|
||||||
import org.apache.lucene.search.similarities.Similarity;
|
import org.apache.lucene.search.similarities.Similarity;
|
||||||
import org.apache.lucene.store.SleepingLockWrapper;
|
|
||||||
import org.apache.lucene.util.InfoStream;
|
import org.apache.lucene.util.InfoStream;
|
||||||
import org.apache.lucene.util.PrintStreamInfoStream;
|
import org.apache.lucene.util.PrintStreamInfoStream;
|
||||||
import org.apache.lucene.util.SetOnce;
|
import org.apache.lucene.util.SetOnce;
|
||||||
|
@ -87,13 +86,6 @@ public final class IndexWriterConfig extends LiveIndexWriterConfig {
|
||||||
*/
|
*/
|
||||||
public final static double DEFAULT_RAM_BUFFER_SIZE_MB = 16.0;
|
public final static double DEFAULT_RAM_BUFFER_SIZE_MB = 16.0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Default value for the write lock timeout (0 ms: no sleeping).
|
|
||||||
* @deprecated Use {@link SleepingLockWrapper} if you want sleeping.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static final long WRITE_LOCK_TIMEOUT = 0;
|
|
||||||
|
|
||||||
/** Default setting for {@link #setReaderPooling}. */
|
/** Default setting for {@link #setReaderPooling}. */
|
||||||
public final static boolean DEFAULT_READER_POOLING = false;
|
public final static boolean DEFAULT_READER_POOLING = false;
|
||||||
|
|
||||||
|
@ -245,24 +237,6 @@ public final class IndexWriterConfig extends LiveIndexWriterConfig {
|
||||||
return mergeScheduler;
|
return mergeScheduler;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the maximum time to wait for a write lock (in milliseconds) for this
|
|
||||||
* instance. Note that the value can be zero, for no sleep/retry behavior.
|
|
||||||
*
|
|
||||||
* <p>Only takes effect when IndexWriter is first created.
|
|
||||||
* @deprecated Use {@link SleepingLockWrapper} if you want sleeping.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public IndexWriterConfig setWriteLockTimeout(long writeLockTimeout) {
|
|
||||||
this.writeLockTimeout = writeLockTimeout;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getWriteLockTimeout() {
|
|
||||||
return writeLockTimeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the {@link Codec}.
|
* Set the {@link Codec}.
|
||||||
*
|
*
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.apache.lucene.index.IndexWriter.IndexReaderWarmer;
|
||||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||||
import org.apache.lucene.search.IndexSearcher;
|
import org.apache.lucene.search.IndexSearcher;
|
||||||
import org.apache.lucene.search.similarities.Similarity;
|
import org.apache.lucene.search.similarities.Similarity;
|
||||||
import org.apache.lucene.store.SleepingLockWrapper;
|
|
||||||
import org.apache.lucene.util.InfoStream;
|
import org.apache.lucene.util.InfoStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,13 +60,6 @@ public class LiveIndexWriterConfig {
|
||||||
/** {@link MergeScheduler} to use for running merges. */
|
/** {@link MergeScheduler} to use for running merges. */
|
||||||
protected volatile MergeScheduler mergeScheduler;
|
protected volatile MergeScheduler mergeScheduler;
|
||||||
|
|
||||||
/**
|
|
||||||
* Timeout when trying to obtain the write lock on init.
|
|
||||||
* @deprecated Use {@link SleepingLockWrapper} if you want sleeping.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
protected volatile long writeLockTimeout;
|
|
||||||
|
|
||||||
/** {@link IndexingChain} that determines how documents are
|
/** {@link IndexingChain} that determines how documents are
|
||||||
* indexed. */
|
* indexed. */
|
||||||
protected volatile IndexingChain indexingChain;
|
protected volatile IndexingChain indexingChain;
|
||||||
|
@ -115,7 +107,6 @@ public class LiveIndexWriterConfig {
|
||||||
openMode = OpenMode.CREATE_OR_APPEND;
|
openMode = OpenMode.CREATE_OR_APPEND;
|
||||||
similarity = IndexSearcher.getDefaultSimilarity();
|
similarity = IndexSearcher.getDefaultSimilarity();
|
||||||
mergeScheduler = new ConcurrentMergeScheduler();
|
mergeScheduler = new ConcurrentMergeScheduler();
|
||||||
writeLockTimeout = IndexWriterConfig.WRITE_LOCK_TIMEOUT;
|
|
||||||
indexingChain = DocumentsWriterPerThread.defaultIndexingChain;
|
indexingChain = DocumentsWriterPerThread.defaultIndexingChain;
|
||||||
codec = Codec.getDefault();
|
codec = Codec.getDefault();
|
||||||
if (codec == null) {
|
if (codec == null) {
|
||||||
|
@ -355,17 +346,6 @@ public class LiveIndexWriterConfig {
|
||||||
public MergeScheduler getMergeScheduler() {
|
public MergeScheduler getMergeScheduler() {
|
||||||
return mergeScheduler;
|
return mergeScheduler;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns allowed timeout when acquiring the write lock.
|
|
||||||
*
|
|
||||||
* @see IndexWriterConfig#setWriteLockTimeout(long)
|
|
||||||
* @deprecated Use {@link SleepingLockWrapper} if you want sleeping.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public long getWriteLockTimeout() {
|
|
||||||
return writeLockTimeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the current {@link Codec}. */
|
/** Returns the current {@link Codec}. */
|
||||||
public Codec getCodec() {
|
public Codec getCodec() {
|
||||||
|
@ -488,8 +468,6 @@ public class LiveIndexWriterConfig {
|
||||||
sb.append("openMode=").append(getOpenMode()).append("\n");
|
sb.append("openMode=").append(getOpenMode()).append("\n");
|
||||||
sb.append("similarity=").append(getSimilarity().getClass().getName()).append("\n");
|
sb.append("similarity=").append(getSimilarity().getClass().getName()).append("\n");
|
||||||
sb.append("mergeScheduler=").append(getMergeScheduler()).append("\n");
|
sb.append("mergeScheduler=").append(getMergeScheduler()).append("\n");
|
||||||
sb.append("default WRITE_LOCK_TIMEOUT=").append(IndexWriterConfig.WRITE_LOCK_TIMEOUT).append("\n");
|
|
||||||
sb.append("writeLockTimeout=").append(getWriteLockTimeout()).append("\n");
|
|
||||||
sb.append("codec=").append(getCodec()).append("\n");
|
sb.append("codec=").append(getCodec()).append("\n");
|
||||||
sb.append("infoStream=").append(getInfoStream().getClass().getName()).append("\n");
|
sb.append("infoStream=").append(getInfoStream().getClass().getName()).append("\n");
|
||||||
sb.append("mergePolicy=").append(getMergePolicy()).append("\n");
|
sb.append("mergePolicy=").append(getMergePolicy()).append("\n");
|
||||||
|
|
|
@ -177,7 +177,6 @@ public class TestIndexWriterConfig extends LuceneTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testConstants() throws Exception {
|
public void testConstants() throws Exception {
|
||||||
// Tests that the values of the constants does not change
|
// Tests that the values of the constants does not change
|
||||||
assertEquals(0, IndexWriterConfig.WRITE_LOCK_TIMEOUT);
|
|
||||||
assertEquals(-1, IndexWriterConfig.DISABLE_AUTO_FLUSH);
|
assertEquals(-1, IndexWriterConfig.DISABLE_AUTO_FLUSH);
|
||||||
assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH, IndexWriterConfig.DEFAULT_MAX_BUFFERED_DELETE_TERMS);
|
assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH, IndexWriterConfig.DEFAULT_MAX_BUFFERED_DELETE_TERMS);
|
||||||
assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH, IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS);
|
assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH, IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS);
|
||||||
|
|
|
@ -209,9 +209,6 @@ public class SolrIndexConfig implements MapSerializable {
|
||||||
if (ramBufferSizeMB != -1)
|
if (ramBufferSizeMB != -1)
|
||||||
iwc.setRAMBufferSizeMB(ramBufferSizeMB);
|
iwc.setRAMBufferSizeMB(ramBufferSizeMB);
|
||||||
|
|
||||||
if (writeLockTimeout != -1)
|
|
||||||
iwc.setWriteLockTimeout(writeLockTimeout);
|
|
||||||
|
|
||||||
iwc.setSimilarity(schema.getSimilarity());
|
iwc.setSimilarity(schema.getSimilarity());
|
||||||
iwc.setMergePolicy(buildMergePolicy(schema));
|
iwc.setMergePolicy(buildMergePolicy(schema));
|
||||||
iwc.setMergeScheduler(buildMergeScheduler(schema));
|
iwc.setMergeScheduler(buildMergeScheduler(schema));
|
||||||
|
|
Loading…
Reference in New Issue